Ultra useful primes: Difference between revisions
Content added Content deleted
(Created Nim solution.) |
(→{{header|J}}: redo for j9.4 which fixes arbitrary precision performance problems) |
||
Line 195: | Line 195: | ||
<syntaxhighlight lang="j">uup=: {{ |
<syntaxhighlight lang="j">uup=: {{ |
||
ref=. 2x^2^y+1 |
ref=. x: 2x^2^y+1 |
||
k=. 1 |
k=. 1 |
||
while. -. 1 p: ref-k do. k=. k+2 end. |
while. -. 1 p: ref-k do. k=. k+2 end. |
||
Line 202: | Line 202: | ||
I don't have the patience to get this little laptop to compute the first 10 such elements, so here I only show the first five: |
I don't have the patience to get this little laptop to compute the first 10 such elements, so here I only show the first five: |
||
<syntaxhighlight lang="j"> uup i. |
<syntaxhighlight lang="j"> uup i.10 |
||
1 3 5 15 5 |
1 3 5 15 5 9 3 299 361 43 |
||
timespacex'uup i.10' |
|||
0.845778 2680</syntaxhighlight> |
|||
=={{header|Julia}}== |
=={{header|Julia}}== |