Ormiston pairs: Difference between revisions

Content added Content deleted
(Added C)
(added Arturo)
Line 114: Line 114:
53369 non-Ormiston "0 MOD 18" pairs bwlow 10000000
53369 non-Ormiston "0 MOD 18" pairs bwlow 10000000
</pre>
</pre>

=={{header|Arturo}}==

<syntaxhighlight lang="arturo">nextPrime: $[n][
ensure -> and? n > 2 odd? n
range .step:2 2+n ∞ | select.first => prime?
| last
]

anagrams?: $[a b] [equal? tally to :string a tally to :string b]

ormiston?: $[n] [and? -> prime? n -> anagrams? n nextPrime n]

print "First 30 Ormiston pairs:"
range .step: 2 3 ∞ | select .first:30 => ormiston?
| map 'x -> @[x nextPrime x]
| loop [a b c d e] -> print [a b c d e]

count: range .step: 2 3 1e6 | enumerate => ormiston?
print ~"\n|count| ormiston pairs less than a million"</syntaxhighlight>

{{out}}

<pre>First 30 Ormiston pairs:
[1913 1931] [18379 18397] [19013 19031] [25013 25031] [34613 34631]
[35617 35671] [35879 35897] [36979 36997] [37379 37397] [37813 37831]
[40013 40031] [40213 40231] [40639 40693] [45613 45631] [48091 48109]
[49279 49297] [51613 51631] [55313 55331] [56179 56197] [56713 56731]
[58613 58631] [63079 63097] [63179 63197] [64091 64109] [65479 65497]
[66413 66431] [74779 74797] [75913 75931] [76213 76231] [76579 76597]

382 ormiston pairs less than a million</pre>


=={{header|C}}==
=={{header|C}}==