Find adjacent primes which differ by a square integer: Difference between revisions
Content added Content deleted
No edit summary |
Drkameleon (talk | contribs) (added Arturo) |
||
Line 111: | Line 111: | ||
997877 - 997813 = 64 |
997877 - 997813 = 64 |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<syntaxhighlight lang="arturo">squares: map 7..15 'x -> x*x |
|||
primes: select 1..1000000 => prime? |
|||
loop.with:'i primes\[0..(size primes)-2] 'p [ |
|||
next: primes\[i+1] |
|||
if contains? squares next-p -> |
|||
print [pad to :string next 6 "-" pad to :string p 6 "=" next-p] |
|||
]</syntaxhighlight> |
|||
{{out}} |
|||
<pre> 89753 - 89689 = 64 |
|||
107441 - 107377 = 64 |
|||
288647 - 288583 = 64 |
|||
368021 - 367957 = 64 |
|||
381167 - 381103 = 64 |
|||
396833 - 396733 = 100 |
|||
400823 - 400759 = 64 |
|||
445427 - 445363 = 64 |
|||
623171 - 623107 = 64 |
|||
625763 - 625699 = 64 |
|||
637067 - 637003 = 64 |
|||
710777 - 710713 = 64 |
|||
725273 - 725209 = 64 |
|||
779477 - 779413 = 64 |
|||
801947 - 801883 = 64 |
|||
803813 - 803749 = 64 |
|||
821741 - 821677 = 64 |
|||
832583 - 832519 = 64 |
|||
838349 - 838249 = 100 |
|||
844841 - 844777 = 64 |
|||
883871 - 883807 = 64 |
|||
912167 - 912103 = 64 |
|||
919511 - 919447 = 64 |
|||
954827 - 954763 = 64 |
|||
981887 - 981823 = 64 |
|||
997877 - 997813 = 64</pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |