#3494: 解釋下面的程式


mark938271 (廖氏天子)


#include <cstdlib>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#define    N    16
using namespace std;

int main(int argc, char *argv[])
{
    long unsigned int p1,p2,p3,L,PN;
    int j,i;
    printf("請輸入");
    scanf("%ld",&L);
    cout<<"\n";
    for(i=2;i<=N;i++)
    {
    p1=pow(2,i-1);
    p2=pow(2,i)-1;
    if(p1*p2>L)
    {
    break;
    }
    p3=sqrt(p2);
    PN=1;
    j=2;
    while(j<=p3)
    {
    if(p2%j==0)
    {
    PN=0;
    break;
    }
    j++;
    }
    if(PN==1)
    printf("%ld\n",p1*p2);
    }
   
    system("PAUSE");
    return EXIT_SUCCESS;
}