Factorial primes: Difference between revisions
Content deleted Content added
m →{{header|Phix}}: 15s |
→{{header|Wren}}: Less repetitious. |
||
Line 345:
var f = 1
while (true) {
if (Int.isPrime(gs[0])) {
Fmt.print("$2d: $2d!
if (c == 10) return
Fmt.print("$2d: $2d! + 1 = $d", c = c + 1, i, f + 1)▼
if (c == 10) return▼
}
i = i + 1
Line 374 ⟶ 372:
===Stretch===
{{libheader|Wren-gmp}}
This takes about 28.5 seconds to reach the 33rd factorial prime on my machine (Core i7) with the last two being
<lang ecmascript>import "./gmp" for Mpz
import "./fmt" for Fmt
Line 386 ⟶ 384:
f.mul(i)
var r = (i < 21) ? 1 : 0 // test for definite primeness below 2^64
var
}
i = i + 1
|