Jump to content

Long primes: Difference between revisions

Added Easylang
(Undo revision 360477 by Chkas (talk))
(Added Easylang)
Line 663:
=={{header|Delphi}}==
See [https://rosettacode.org/wiki/Long_primes#Pascal Pascal].
 
 
=={{header|EasyLang}}==
<syntaxhighlight>
fastfunc isprim num .
if num mod 2 = 0 and num > 2
return 0
.
i = 3
while i <= sqrt num
if num mod i = 0
return 0
.
i += 2
.
return 1
.
prim = 2
proc nextprim . .
repeat
prim += 1
until isprim prim = 1
.
.
func period n .
r = 1
repeat
r = (r * 10) mod n
p += 1
until r <= 1
.
return p
.
#
print "Long primes up to 500 are:"
repeat
nextprim
until prim > 500
if period prim = prim - 1
write prim & " "
cnt += 1
.
.
print ""
print ""
print "The number of long primes up to:"
limit = 500
repeat
if prim > limit
print limit & " is " & cnt
limit *= 2
.
until limit > 32000
if period prim = prim - 1
cnt += 1
.
nextprim
.
</syntaxhighlight>
 
=={{header|F_Sharp|F#}}==
2,044

edits

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