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.


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