HNUSTOJ-1617 Graph(费马数)
1617: Graph
时间限制: 1 Sec 内存限制: 32 MB
提交: 31 解决: 5
[提交][状态][讨论版]
题目描述
Your task is to judge whether a regular polygon can be drawn only by straightedge and compass.
The length of the straightedge is infinite.
The width of the compass is infinite.
The straightedge does not have scale.
输入
There are several test cases. Each test case contains a positive integer n (3<=n<=10^9). The input will be ended by the End Of File.
输出
If the regular polygon with n sides can be drawn only by straightedge and compass, output YES in one line, otherwise, output NO in one line.
样例输入
3
4
5
6
7
样例输出
YES
YES
YES
YES
NO
形如
的数,n≥0。前五个费马数是F0=3,F1=5,F2=17,F3=257,F4=65537,均为素数。据此,1640年,法国数学家P.de费马猜想Fn均为素数,1732年,L.欧拉发现 F5=641×6700417,故费马猜想不真。到目前为止,只知道以上五个费马数是素数。此外,还证明了48个费马数是复合数。这些复合数可以分成三类:①当n=5,6,7时,得到了Fn的标准分解式;②当n=8,9,10,11,12,13,15,16,18,19,21,23,25,26,27,30,32,36,38,39,42,52,55,58,63,73,77,81,117,125,144,150,207,226,228,250,267,268,284,316,452,556,744,1945时,只知道Fn的部分素因数;③当n=14时,只知道F14是复合数,但是它们的任何真因数都不知道。因此,在费马数列中是否有无穷多个素数,或者是否有无穷多个复合数,都是未解决的问题。自从费马猜想被否定后,有人猜想费马数列中只有有限个素数,这一猜想也未解决。还有一个未能证明的猜想:费马数无平方因子。L.J.沃伦于1967年证明了:如果素数q满足q2|Fn,则
费马数有一些简单的性质:如①当整数 k>0时,有
;②设 n>0,Fn 是素数的充分必要条件是
;③设 n>1,Fn的每一个素因数形如
。
1801年,C.F.高斯证明了,当h=
(0≤n1<n2<…<ns,s≥1),Fnt(t=1,2,…,s)都是素数时,正h边形可用圆规和直尺来作图,可见费马数与平面几何的一些问题有联系。近年来,费马数在数字信号处理中得到应用。例如,费马数变换(FNT),即以费马数给出的数轮变换,在数论变换中最为有用。
#include<iostream>
#include<cstring>
#include<cstdio> using namespace std;
const int feimap[] = {, , , , }; bool fun(int x){
return (!(x & (x - ))) && x;
}
int main(){
int n;
while(scanf("%d", &n) == ){
for(int i = ; i < ; i++) if(n % feimap[i] == ) n /= feimap[i];
printf("%s\n", fun(n)?"YES":"NO");
}
return ;
}
HNUSTOJ-1617 Graph(费马数)的更多相关文章
- WUSTOJ 1326: Graph(Java)费马数
题目链接:1326: Graph 参考博客:HNUSTOJ-1617 Graph(费马数)--G2MI Description Your task is to judge whether a regu ...
- Graph(2014辽宁ACM省赛)
问题 F: Graph 时间限制: 1 Sec 内存限制: 128 MB 提交: 30 解决: 5 [cid=1073&pid=5&langmask=0" style=& ...
- [开发笔记] Graph Databases on developing
TimeWall is a graph databases github It be used to apply mathematic model and social network with gr ...
- Introduction to graph theory 图论/脑网络基础
Source: Connected Brain Figure above: Bullmore E, Sporns O. Complex brain networks: graph theoretica ...
- POJ 2125 Destroying the Graph 二分图最小点权覆盖
Destroying The Graph Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8198 Accepted: 2 ...
- [LeetCode] Number of Connected Components in an Undirected Graph 无向图中的连通区域的个数
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...
- [LeetCode] Graph Valid Tree 图验证树
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...
- [LeetCode] Clone Graph 无向图的复制
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's ...
- 讲座:Influence maximization on big social graph
Influence maximization on big social graph Fanju PPT链接: social influence booming of online social ne ...
随机推荐
- webpack-merge
配置分离 随着我们业务逻辑的增多,图片.字体.css.ES6以及CSS预处理器和后处理器逐渐的加入到我们的项目中来,进而导致配置文件的增多,使得配置文件书写起来比较繁琐,更严重者(书写特定文件的位置会 ...
- Python 学习随笔 - 2 - list 、tuple 、dict、set 特殊数据类型 及 实际应用
1.list list是一种有序的集合,可以随时添加和删除其中的元素; 和C语言不同的地方是list里的元素甚至可以是不同类型的,甚至是另个list 例如:['A', 'B', 'C'] ['A ...
- 知乎面试【五轮技术+HR】
今年下半年去知乎面试了两次,讲道理来说,知乎有CD期, 一旦上一次面试没有通过.在一段时间内,不能再次面试知乎.后来在同事的内推下,再次获得面试机会,哈哈~~,这次面试时间还是挺长的,特记录一下. 7 ...
- Shell中的$0、$1、$2的含义
在 shell 中我们会见到 $0.$1.$2这样的符号,这是什么意思呢? 简单来说 $0 就是你写的shell脚本本身的名字,$1 是你给你写的shell脚本传的第一个参数,$2 是你给你写的she ...
- web框架性能点
awesome-go-web-frameworks/README.md at master · speedwheel/awesome-go-web-frameworkshttps://github.c ...
- linux内核中IS_ALIGNED是如何定义的?
1. 定义如下: (include/linux/kernel.h) #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a ...
- 002-创建型-05-原型模式(Protype)
一.概述 指原型实例指定创建对象的种类,并通过克隆这些原型创建新的对象 原型模式就是让类实现Cloneable接口,达到克隆原型类的方式. 1.1.适用场景 1.在创建对象的时候,我们不只是希望被创建 ...
- java如何获取项目的工作目录
package maptoxml; public class Tfff { public static void main(String[] args) { System.out.println(&q ...
- 爆库记录(X-Forwarded-For注入漏洞实战 记录)
环境位置: https://www.mozhe.cn/bug/detail/QWxmdFFhVURDay90L0wxdmJXSkl5Zz09bW96aGUmozhe 参考: http://www.fr ...
- Kafka Connect REST Interface
Since Kafka Connect is intended to be run as a service, it also supports a REST API for managing con ...