31 lines
572 B
Text
31 lines
572 B
Text
arraybase 1
|
|
dim smar(100)
|
|
smar[1] = 2
|
|
|
|
cont = 1
|
|
i = 1
|
|
|
|
print 1, 2
|
|
while cont < 100
|
|
i += 2
|
|
if not isPrime(i) then continue while
|
|
for j = 1 to length(string(i))
|
|
digit = int(mid(string(i),j,1))
|
|
if not isPrime(digit) then continue while
|
|
next j
|
|
cont += 1
|
|
smar[cont] = i
|
|
if cont = 100 or cont <= 25 then print cont, smar[cont]
|
|
end while
|
|
end
|
|
|
|
function isPrime(v)
|
|
if v < 2 then return False
|
|
if v mod 2 = 0 then return v = 2
|
|
if v mod 3 = 0 then return v = 3
|
|
d = 5
|
|
while d * d <= v
|
|
if v mod d = 0 then return False else d += 2
|
|
end while
|
|
return True
|
|
end function
|