Definitions
In mathematics, additive primes are prime numbers for which the sum of their decimal digits are also primes.



Task
Write a program to determine (and show here) all additive primes less than 500.

Optionally, show the number of additive primes.



Also see

   the OEIS entry:   A046704 additive primes.
   the prime-numbers entry:   additive primes.
   the geeks for geeks entry: additive prime number.
   the prime-numbers fandom: additive primes.


#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