2023-07-01 11:58:00 -04:00
|
|
|
function isPrime(number)
|
2025-08-11 18:05:26 -07:00
|
|
|
if (number % 2 = 0) or (number % 3 = 0) then return false
|
|
|
|
|
lim = sqr(number)
|
2023-07-01 11:58:00 -04:00
|
|
|
|
2025-08-11 18:05:26 -07:00
|
|
|
for i = 5 to lim step 2
|
|
|
|
|
if number % i = 0 then return false
|
|
|
|
|
next i
|
2023-07-01 11:58:00 -04:00
|
|
|
|
2025-08-11 18:05:26 -07:00
|
|
|
return true
|
2023-07-01 11:58:00 -04:00
|
|
|
end function
|
|
|
|
|
|
|
|
|
|
i = 42
|
|
|
|
|
counter = 0
|
|
|
|
|
while counter < 42
|
2025-08-11 18:05:26 -07:00
|
|
|
if isPrime(i) then
|
|
|
|
|
counter += 1
|
|
|
|
|
print "n = "; counter, i
|
|
|
|
|
i += i - 1
|
|
|
|
|
end if
|
|
|
|
|
i += 1
|
2023-07-01 11:58:00 -04:00
|
|
|
end while
|
|
|
|
|
end
|