Find prime numbers of the form n*n*n+2: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Wren-trait -> Wren-iterate) |
Drkameleon (talk | contribs) (added Arturo) |
||
Line 188: | Line 188: | ||
189: 6751271 |
189: 6751271 |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<syntaxhighlight lang="arturo">primes: [] |
|||
loop 1..199 'i [ |
|||
num: 2 + i^3 |
|||
if prime? num -> |
|||
'primes ++ @[to :string i, to :string num] |
|||
] |
|||
loop primes [i, num][ |
|||
prints pad i 4 |
|||
print pad num 9 |
|||
]</syntaxhighlight> |
|||
{{out}} |
|||
<pre> 1 3 |
|||
3 29 |
|||
5 127 |
|||
29 24391 |
|||
45 91127 |
|||
63 250049 |
|||
65 274627 |
|||
69 328511 |
|||
71 357913 |
|||
83 571789 |
|||
105 1157627 |
|||
113 1442899 |
|||
123 1860869 |
|||
129 2146691 |
|||
143 2924209 |
|||
153 3581579 |
|||
171 5000213 |
|||
173 5177719 |
|||
189 6751271</pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |