Void main ()
{
Unsigned long int mp, b;
Int I, n, j=0, z=0, k, the count=1, a;
for(n=2; n<=64; N++)
{
for(i=2; i<=n; I++)
{
If I (n %==0)
{j++; }
}
If (j==1)
{
For (a=2; A<=n; +)
{b=2. * 2; }
Mp=b - 1;
}
For (k=2; K<=mp; K++)
{
If (mp % k==0)
Z++;
}
If (z==1)
Number {printf (" % d: mersenne prime % llu \ n ", count, mp); }
count++;
}
}
CodePudding user response:
Modified as follows, for your reference:# include
Void main ()
{
Unsigned long int mp, b=2;
Int I, n, j=0, z=0, k, the count=1, a;
for(n=2; n<32. N++)//for (n=2; n<=64; N++)
{
Z=0;
//for (I=2; i<=n; I++)
//{
//if I (n %==0)
//{j++; }
//}
//if (j==1)
//{
//for (a=2; A<=n; +)
B *=2;//{b=2 * 2};
Mp=b - 1;
//}
For (k=2; K<=mp/2; K++)
{
If (mp % k==0)
{z++; break; }
}
If (z!
=1)Number {printf (" % d: mersenne prime % llu \ n ", count++, mp); }
//count++;
}
}
//the first mersenne prime: when p=2, M_2==3 (2 ^ 2) - 1, digits for one, was found in around 300 BC,
//second mersenne prime: when p=3, M_3=(2 ^ 3) - 1=7, the figures for one, is found in about 300 BC,
//3 mersenne prime: when p=5, M_5==(2 ^ 5) - 1, 31 digits for two, found in about 100 BC,
//a mersenne 4: when p=7, M_7=(2 ^ (7) - 1=127, digits for three, found in about 300 BC,
//5 mersenne prime: when p=13 M_13=(2 ^ 13) - 1=8191, four digits for, found in AD 1456,
//6 a mersenne prime: when p=17, M_17=(17) ^ 2-1=131071, six digits for, discovered by Cataldi in AD 1588,
//the seventh mersenne prime: when p=19, M_19=(2 ^ 19) - 1=524287, six digits for, discovered by Cataldi in AD 1588,
//a mersenne 8: when p=31 M_31=(2 ^ 31) - 1=2147483647, median of 10, discovered by Euler in AD 1772,
//a mersenne 9: when p=61, M_61=(2 ^ 61) 1, digits for 19, discovered by Pervushin in AD 1883,
//a 10th mersenne prime: when p=89, M_89=(2 ^ 89) 1, digits for 27, discovered by Powers in AD 1911,
//11 mersenne prime: when p=107, M_107=(2 ^ 107) 1, digits for 33, discovered by Powers in AD 1914,
//12th mersenne prime: when p=127, M_127=(2 ^ 89) 1, digits for 39, discovered by Lucas in AD 1876,
//13th mersenne prime: when p=521, M_521=(2 ^ 521) 1, figures for 157, discovered by Robinson in AD 1952,
//a mersenne prime: 14 when p=607, M_607=(2 ^ 607) 1, figures for 183, discovered by Robinson in AD 1952,
//15th mersenne prime: when p=1279, M_1279=(2 ^ 1279) 1, figures for 386, discovered by Robinson in AD 1952,
//16th mersenne prime: when p=2203, M_2203=(2 ^ 2203) 1, figures for 664, discovered by Robinson in AD 1952,
//17th mersenne prime: when p=2281, M_2281=(2 ^ 2281) 1, figures for 687, discovered by Robinson in AD 1952,
//18th mersenne prime: when p=3217, M_3217=(2 ^ 3217) 1, figures for 969, discovered by Riesel in AD 1957,
//the 19th mersenne prime: when p=4253, M_4253=(2 ^ 4253) 1, figures for 1281, discovered by Hurwitz in AD 1961,
//20th mersenne prime: when p=4423, M_4423=(2 ^ 4423) 1, figures for 1332, discovered by Hurwitz in AD 1961,
//a mersenne prime: 21 when p=9689, M_9689=(2 ^ 9689) 1, figures for 2971, discovered by Gillies in AD 1963,
//22nd mersenne prime: when p=9941, M_9941=(2 ^ 9941) 1, figures for 2993, discovered by Gillies in AD 1963,
//23rd mersenne prime: when p=11213, M_11213=(2 ^ 11213) 1, figures for 3376, discovered by Gillies in AD 1963,
//...
CodePudding user response:
That last break what roleCodePudding user response: