Jump to content

Ormiston pairs: Difference between revisions

Added Easylang
(→‎{{header|Haskell}}: Fractionally more efficient)
(Added Easylang)
Line 620:
Elapsed Time: 10.046 Sec.
 
</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight>
fastfunc isprim num .
i = 2
while i <= sqrt num
if num mod i = 0
return 0
.
i += 1
.
return 1
.
fastfunc nextprim n .
repeat
n += 1
until isprim n = 1
.
return n
.
func digs n .
while n > 0
r += pow 10 (n mod 10)
n = n div 10
.
return r
.
print "First 30 Ormiston pairs:"
a = 2
repeat
b = a
db = da
a = nextprim a
until a > 1000000
da = digs a
if da = db
cnt += 1
if cnt <= 30
write "(" & b & " " & a & ") "
.
.
.
print ""
print "Ormiston pairs up to million: " & cnt
</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)
Ormiston pairs up to million: 382
</pre>
 
2,063

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.