23 lines
433 B
Text
23 lines
433 B
Text
BOOL local fn IsPrime( n as long )
|
|
if ( n == 2 ) then return YES
|
|
if ( n < 2 || n % 2 == 0 ) then return NO
|
|
for long i = 3 to sqr(n) step 2
|
|
if ( ( n % i ) == 0 ) then return NO
|
|
next i
|
|
end fn = YES
|
|
|
|
void local fn DoIt
|
|
long count = 0
|
|
for long i = 42 to LONG_MAX
|
|
if ( fn IsPrime( i ) )
|
|
count++
|
|
print count,i
|
|
if ( count == 42 ) then break
|
|
i += i
|
|
end if
|
|
next
|
|
end fn
|
|
|
|
fn DoIt
|
|
|
|
HandleEvents
|