Lucas-Lehmer test: Difference between revisions
Content deleted Content added
adding maxima |
Updated D code |
||
Line 310:
<lang d>import std.stdio, std.math, std.bigint;
bool isPrime(int p) pure nothrow {
if (p < 2 || p % 2 == 0)
foreach (i; 3 ..
if (p % i
return true
}
bool isMersennePrime(int p) /*pure nothrow*/ {
if (!isPrime(p))
auto s
s = (s ^^ 2 - 2) % mp;
return s == 0;
}
void main() {
if (isMersennePrime(p)) {
▲ foreach(p ; 2..10000)
▲ stdout.flush() ;
}
}</lang>
|