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"> |
||
fastfunc isPrime num . |
|||
result = 0 |
|||
if num mod 2 = 0 and num > 2 |
if num mod 2 = 0 and num > 2 |
||
return 0 |
|||
. |
. |
||
i = 3 |
|||
while i <= sqrt num |
|||
if num mod i = 0 |
if num mod i = 0 |
||
return 0 |
|||
. |
. |
||
i += 2 |
|||
. |
. |
||
return 1 |
|||
. |
. |
||
curPrime = 1 |
|||
currentPrime = 2 |
|||
⚫ | |||
# Because 2 is the 1st prime number, |
|||
# We will start counting primes from the 2nd |
|||
⚫ | |||
repeat |
repeat |
||
curPrime += 1 |
|||
until isPrime curPrime = 1 |
|||
until result = 1 |
|||
. |
. |
||
. |
. |
||
print |
print curPrime |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{out}} |
{{out}} |