RosettaCodeData/Task/Smarandache-prime-digital-sequence/FutureBasic/smarandache-prime-digital-sequence.basic
2024-10-16 18:07:41 -07:00

34 lines
645 B
Text

_max = 35000
clear local fn smarandache
int num, p, primes(_max), count = 1
int test = bit(2)|bit(3)|bit(5)|bit(7)
print @"\n First 25:\n 2";
for num = 3 to _max step 2
if primes(num) then continue
for p = num * num to _max step num*2
primes(p) = 1
next
p = num
while test & bit(p % 10)
p /= 10
wend
if p then continue
count++
if count < 26
print fn stringwithformat( @"%6d", num);
if (count mod 5) == 0 then print
end if
if count == 100 then printf @"\n 100th: %d", num : break
next
end fn
window 1, @"Smarandache Primes"
fn smarandache
handleevents