Sum of two adjacent numbers are primes: Difference between revisions
Sum of two adjacent numbers are primes (view source)
Revision as of 21:58, 17 February 2024
, 3 months agoAdded Easylang
(add RPL) |
(Added Easylang) |
||
(One intermediate revision by one other user not shown) | |||
Line 622:
</pre>
=={{header|EasyLang}}==
{{trans|BASIC256}}
<syntaxhighlight>
fastfunc isprim num .
i = 2
while i <= sqrt num
if num mod i = 0
return 0
.
i += 1
.
return 1
.
print "The first 20 pairs of numbers whose sum is prime:"
repeat
n += 1
sum = 2 * n + 1
if isprim sum = 1
print n & " + " & n + 1 & " = " & sum
cnt += 1
.
until cnt = 20
.
</syntaxhighlight>
=={{header|F_Sharp|F#}}==
Line 1,557 ⟶ 1,582:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="
import "./fmt" for Fmt
|