23 lines
375 B
Plaintext
23 lines
375 B
Plaintext
#include "isprime.bas"
|
|
|
|
function digsum( n as uinteger ) as uinteger
|
|
dim as uinteger s
|
|
while n
|
|
s+=n mod 10
|
|
n\=10
|
|
wend
|
|
return s
|
|
end function
|
|
|
|
dim as uinteger s
|
|
|
|
print "Prime","Digit Sum"
|
|
for i as uinteger = 2 to 499
|
|
if isprime(i) then
|
|
s = digsum(i)
|
|
if isprime(s) then
|
|
print i, s
|
|
end if
|
|
end if
|
|
next i
|