zoukankan      html  css  js  c++  java
  • 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满足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[5] = {3, 5, 17, 257, 65537};
     
    bool fun(int x){
        return (!(x & (x - 1))) && x;
    }
    int main(){
        int n;
        while(scanf("%d", &n) == 1){
            for(int i = 0; i < 5; i++) if(n % feimap[i] == 0) n /= feimap[i];
            printf("%s
    ", fun(n)?"YES":"NO");
        }
        return 0;
    }
  • 相关阅读:
    python之private variable
    python实例、类方法、静态方法
    python常用option
    access
    FD_CLOEXEC
    fork后父子进程文件描述问题
    split
    信号
    kill
    进程组&Session
  • 原文地址:https://www.cnblogs.com/Pretty9/p/7406698.html
Copyright © 2011-2022 走看看