Ultra useful primes: Difference between revisions

New post.
(Added FreeBasic)
(New post.)
Line 224:
<syntaxhighlight lang="j"> uup i.10
1 3 5 15 5 59 159 189 569 105</syntaxhighlight>
 
 
=={{header|Java}}==
<syntaxhighlight lang="java">
 
import java.math.BigInteger;
 
public final class UltraUsefulPrimes {
 
public static void main(String[] args) {
for ( int n = 1; n <= 10; n++ ) {
showUltraUsefulPrime(n);
}
}
private static void showUltraUsefulPrime(int n) {
BigInteger prime = BigInteger.ONE.shiftLeft(1 << n);
BigInteger k = BigInteger.ONE;
while ( ! prime.subtract(k).isProbablePrime(20) ) {
k = k.add(BigInteger.TWO);
}
System.out.print(k + " ");
}
 
}
</syntaxhighlight>
{{ out }}
<pre>
1 3 5 15 5 59 159 189 569 105
</pre>
 
=={{header|Julia}}==
902

edits