23 lines
346 B
Text
23 lines
346 B
Text
|
|
function isPrime(number)
|
||
|
|
if (number % 2 = 0) or (number % 3 = 0) then return false
|
||
|
|
lim = sqr(number)
|
||
|
|
|
||
|
|
for i = 5 to lim step 2
|
||
|
|
if number % i = 0 then return false
|
||
|
|
next i
|
||
|
|
|
||
|
|
return true
|
||
|
|
end function
|
||
|
|
|
||
|
|
i = 42
|
||
|
|
counter = 0
|
||
|
|
while counter < 42
|
||
|
|
if isPrime(i) then
|
||
|
|
counter += 1
|
||
|
|
print "n = "; counter, i
|
||
|
|
i += i - 1
|
||
|
|
end if
|
||
|
|
i += 1
|
||
|
|
end while
|
||
|
|
end
|