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. C# 下划线转驼峰

    /// <summary> /// 转换 /// </summary> /// <param name="sender"></param& ...

  2. LeetCode 第 151 场周赛

    一.查询无效交易(LeetCode-1169) 1.1 题目描述 1.2 解题思路 根据,它和另一个城市中同名的另一笔交易相隔不超过 60 分钟(包含 60 分钟整) 得出 城市A和其他城市任何一笔交 ...

  3. mysql全面优化

    在进行MySQL的优化之前,必须要了解的就是MySQL的查询过程,很多查询优化工作实际上就是遵循一些原则,让MySQL的优化器能够按照预想的合理方式运行而已. 图-MySQL查询过程 一.优化的哲学 ...

  4. 如何在虚拟机中安装kali linux

    整理笔记,把以前印象笔记中记录的一些东西翻出来,想想发个随笔吧. 第一步在官网下载kali linux的镜像. 网址:https://www.kali.org/downloads/ (我的电脑是64位 ...

  5. eclipse手动添加本地jar包到本地maven仓库

    在使用maven进行构建项目时,有时候中央仓库不包含所需的jar包,就需要下载到本地后手动添加到本地仓库中.这里介绍下利用eclipse进行本地jar安装到maven本地仓库. 在Eclipse项目中 ...

  6. 跨平台免费极简的markdown工具

    1. 工具名 typora 2. 工具官网 https://www.typora.io

  7. 利用redis实现分布式事务锁,解决高并发环境下库存扣减

    利用redis实现分布式事务锁,解决高并发环境下库存扣减   问题描述: 某电商平台,首发一款新品手机,每人限购2台,预计会有10W的并发,在该情况下,如果扣减库存,保证不会超卖 解决方案一 利用数据 ...

  8. java生成RSA公私钥字符串,简单易懂

    java生成RSA公私钥字符串,简单易懂   解决方法: 1.下载bcprov-jdk16-140.jar包,参考:http://www.yayihouse.com/yayishuwu/chapter ...

  9. Kafka——副本(Replica)机制

    副本定义 Kafka 是有主题概念的,而每个主题又进一步划分成若干个分区.副本的概念实际上是在分区层级下定义的,每个分区配置有若干个副本. 所谓副本(Replica),本质就是一个只能追加写消息的提交 ...

  10. (十六)toString()的用法

    每一个非基本类型的对象都有一个toString()方法,而且当编译器需要一个String而你却只有一个对象时候,该方法便会被调用. public class te { public String to ...