Largest difference between adjacent primes: Difference between revisions
Largest difference between adjacent primes (view source)
Revision as of 20:48, 20 April 2024
, 2 months agoAdded Easylang
No edit summary |
(Added Easylang) |
||
Line 283:
</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 prim .
repeat
prim += 1
until isprim prim = 1
.
return prim
.
prim = 2
repeat
prev = prim
prim = nextprim prim
until prim > 1e6
max = higher max (prim - prev)
.
print max
</syntaxhighlight>
{{out}}
<pre>
114
</pre>
=={{header|F_Sharp|F#}}==
|