Ultra useful primes: Difference between revisions

(Added Sidef)
Line 155:
3.896011 seconds (266.08 k allocations: 19.988 MiB, 1.87% compilation time)
</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>ClearAll[FindUltraUsefulPrimeK]
FindUltraUsefulPrimeK[n_] := Module[{num, tmp},
num = 2^(2^n);
Do[
If[PrimeQ[num - k],
tmp = k;
Break[];
]
,
{k, 1, \[Infinity], 2}
];
tmp
]
res = FindUltraUsefulPrimeK /@ Range[13];
TableForm[res, TableHeadings -> Automatic]</lang>
{{out}}
<pre>1 1
2 3
3 5
4 15
5 5
6 59
7 159
8 189
9 569
10 105
11 1557</pre>
 
=={{header|Perl}}==
1,111

edits