Lucas-Lehmer test: Difference between revisions
→{{header|langur}}
(Added Easylang) |
Langurmonkey (talk | contribs) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 2,281:
=={{header|langur}}==
{{trans|D}}
▲I suppose it is theoretically possible to test to the 47th Mersenne prime, as stated in the task description, though it could take a while. As for the limit, it would be very high.
.i == 2 or .i > 2 and
▲<syntaxhighlight lang="langur">val .isPrime = f .i == 2 or
}
▲ .i > 2 and not any f(.x) .i div .x, pseries 2 .. .i ^/ 2
val .isMersennePrime =
if .p == 2: return true
if not .isPrime(.p): return false
Line 2,299 ⟶ 2,298:
}
writeln join " ", map
</syntaxhighlight>
{{out}}
|