Primes: n*2^m+1: Difference between revisions
m
→{{header|Phix}}: use pygments
(→{{header|Java}}: Tweak for faster calculation) |
m (→{{header|Phix}}: use pygments) |
||
Line 3,069:
=={{header|Phix}}==
{{trans|Wren}}
<!--
with javascript_semantics
include mpfr.e
printf(1," N M Prime\n------------------\n")
mpz p = mpz_init()
for n=1 to 400 do
integer m = 0
while true do
mpz_set_si(p,n)
mpz_mul_2exp(p,p,m)
mpz_add_si(p,p,1)
if mpz_prime(p) then
printf(1,"%3d %4d %s\n", {n,m,mpz_get_short_str(p)})
exit
end if
m += 1
end while
end for
▲<!--</syntaxhighlight>-->
</syntaxhighlight>
Output same as Wren (plus a few not particularly helpful digit counts).
=={{header|Python}}==
{{libheader|gmpy2}}
|