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满足q2Fn,则

费马数有一些简单的性质:如①当整数 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(费马数)的更多相关文章

  1. WUSTOJ 1326: Graph(Java)费马数

    题目链接:1326: Graph 参考博客:HNUSTOJ-1617 Graph(费马数)--G2MI Description Your task is to judge whether a regu ...

  2. Graph(2014辽宁ACM省赛)

    问题 F: Graph 时间限制: 1 Sec  内存限制: 128 MB 提交: 30  解决: 5 [cid=1073&pid=5&langmask=0" style=& ...

  3. [开发笔记] Graph Databases on developing

    TimeWall is a graph databases github It be used to apply mathematic model and social network with gr ...

  4. Introduction to graph theory 图论/脑网络基础

    Source: Connected Brain Figure above: Bullmore E, Sporns O. Complex brain networks: graph theoretica ...

  5. POJ 2125 Destroying the Graph 二分图最小点权覆盖

    Destroying The Graph Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8198   Accepted: 2 ...

  6. [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), ...

  7. [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), ...

  8. [LeetCode] Clone Graph 无向图的复制

    Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's ...

  9. 讲座:Influence maximization on big social graph

    Influence maximization on big social graph Fanju PPT链接: social influence booming of online social ne ...

随机推荐

  1. 小福bbs-凡事预则立

    [小福bbs-凡事预则立] 1.冲刺的时间计划安排(冲刺时间为期七天,安排在2019-11-3--2019-11-14之间) 冲刺的时间 计划安排 2019.11.7 开会,安排具体工作 2019.1 ...

  2. 纯CSS画三角形(带边框)

    实例一: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...

  3. Laravel 中 Session 的使用问题(dd()导致laravel中session取值问题)

    Laravel 中 Session 的使用问题(dd()导致laravel中session取值问题) 一.总结 一句话总结: Laravel 会首先收集需要写入 Session 的所有数据,并在用户的 ...

  4. ORACLE中声明变量:define variable declare

    在sqlplus 环境中,声明变量的关键字:define variable declare 一.define关键字(host变量) host变量的作用是一个替换作用,是主机环境与oracle进行交互的 ...

  5. 将bat文件注册成为系统服务

    第一章 注册系统服务准备 1.1      注册系统服务前准备 1.1.1 涉及第三方软件 Bat_To_Exe_Converter.exe (将*.bat文件转化为可执行*.exe文件) insts ...

  6. Matlab注释的几个方法

    Matlab最简单的注释当然是 %x= %这是注释,无法运行 x= %结果为2 然而%只能注释一行,如何注释更加快捷简便地注释多行呢? %{ .这就是传说中的多行注释 .成功! %} 经常需要调试程序 ...

  7. unyielding 是否屈服与多线程 勿以恶小而为之 threads are a bad idea

    小结: 1. python的妥协 2. As we know, threads are a bad idea, (for most purposes). Threads make local reas ...

  8. git如何获取获取子模块的代码?

    答: 步骤如下: 1. git submodule init 2. git submodule update

  9. SQL-W3School-函数:SQL NOW() 函数

    ylbtech-SQL-W3School-函数:SQL NOW() 函数 1.返回顶部 1. NOW() 函数 NOW 函数返回当前的日期和时间. 提示:如果您在使用 Sql Server 数据库,请 ...

  10. python之socket编程(二)

    标签(空格分隔): socket编程 SocketServer解析 SocketServer内部使用I/O多路复用,多线程,多进程来实现客户端多并发访问Socket服务端,while循环时使用I/O多 ...