Jump to content

Mersenne primes: Difference between revisions

Frink
m (reorder)
(Frink)
Line 492:
2^ 19 - 1
2^ 31 - 1
</pre>
 
=={{header|Frink}}==
Frink has built-in routines for iterating through prime numbers. Frink's <CODE>isPrime[n]</CODE> function automatically detects numbers of the form 2^n-1 and performs a more efficient Lucas-Lehmer primality test on the number. This works with arbitrarily large numbers.
 
Did you know that all Java-based JVM languages are many many orders of magnitude faster because Frink's developer contributed vastly faster BigInteger algorithms to Java 1.8 and later? Operations that used to take days now can be done in seconds thanks to Frink's contributions to Java.
<lang frink>for n = primes[]
if isPrime[2^n - 1]
println["2^$n - 1"]</lang>
{{out}}
<pre>
2^2 - 1
2^3 - 1
2^5 - 1
2^7 - 1
2^13 - 1
2^17 - 1
2^19 - 1
2^31 - 1
2^61 - 1
2^89 - 1
2^107 - 1
2^127 - 1
2^521 - 1
2^607 - 1
2^1279 - 1
2^2203 - 1
2^2281 - 1
2^3217 - 1
2^4253 - 1
2^4423 - 1
...
</pre>
 
494

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.