10001th prime: Difference between revisions

Content added Content deleted
imported>Maxima enthusiast
No edit summary
Line 586: Line 586:
=={{header|EasyLang}}==
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
<syntaxhighlight lang="easylang">
proc isPrime num . result .
fastfunc isPrime num .
result = 0
if num mod 2 = 0 and num > 2
if num mod 2 = 0 and num > 2
break 1
return 0
.
.
for i = 3 step 2 to sqrt num
i = 3
while i <= sqrt num
if num mod i = 0
if num mod i = 0
break 2
return 0
.
.
i += 2
.
.
result = 1
return 1
.
.
curPrime = 1
currentPrime = 2
for i = 1 to 10001
# Because 2 is the 1st prime number,
# We will start counting primes from the 2nd
for i = 2 to 10001
repeat
repeat
currentPrime += 1
curPrime += 1
call isPrime currentPrime result
until isPrime curPrime = 1
until result = 1
.
.
.
.
print currentPrime
print curPrime
</syntaxhighlight>
</syntaxhighlight>
{{out}}
{{out}}