Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,28 @@
print "Prime", "Digit Sum"
for i = 2 to 499
if isprime(i) then
s = digSum(i)
if isPrime(s) then print i, s
end if
next i
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
function digsum(n)
s = 0
while n
s += n mod 10
n /= 10
end while
return s
end function