Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Additive-primes/FreeBASIC/additive-primes.basic
Normal file
22
Task/Additive-primes/FreeBASIC/additive-primes.basic
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue