Wagstaff primes: Difference between revisions
Content added Content deleted
(→{{header|J}}: include stretch goal, throw in timings for fun) |
(→{{header|J}}: include implementation for stretch goal) |
||
Line 268: | Line 268: | ||
Stretch goal (times are elapsed times, machine was a 1.2GHz intel i3): |
Stretch goal (times are elapsed times, machine was a 1.2GHz intel i3): |
||
<syntaxhighlight lang=J> |
<syntaxhighlight lang=J>{{ |
||
T0=. 6!:1'' |
|||
f=. 3%~1+2x^] |
|||
c=. 0 |
|||
echo 'count power seconds' |
|||
for_p. p:i.1e4 do. |
|||
if. 1 p: f p do. |
|||
c=. c+1 |
|||
echo 5 6 8j3":c, p, (6!:1'')-T0 |
|||
if. 24 <: c do. EMPTY return. end. |
|||
end. |
|||
end. |
|||
}}_ |
|||
count power seconds |
|||
1 3 0.004 |
1 3 0.004 |
||
2 5 0.006 |
2 5 0.006 |