Jump to content

Ultra useful primes: Difference between revisions

m
julia example
(→‎{{header|Wren}}: Added a CLI version and marginal improvement for embedded version.)
m (julia example)
Line 34:
1 3 5 15 5 59 159 189 569 105
</pre>
 
=={{header{{Julia}}==
<lang julia>using Primes
 
nearpow2pow2prime(n) = findfirst(k -> isprime(2^(big"2"^n) - k), 1:10000)
 
@time println([nearpow2pow2prime(n) for n in 1:12])
</lang>{{out}}
<pre>
[1, 3, 5, 15, 5, 59, 159, 189, 569, 105, 1557, 2549]
3.896011 seconds (266.08 k allocations: 19.988 MiB, 1.87% compilation time)
</pre>
 
 
 
=={{header|Perl}}==
4,108

edits

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