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.


// Rosetta Code problem: http://rosettacode.org/wiki/Additive_primes
// by Galileo, 06/2022
 
limit = 500
 
dim flags(limit)
 
for i = 2 to  limit
    for k = i*i to limit step i 
        flags(k) = 1
    next
    if flags(i) = 0 primes$ = primes$ + str$(i) + " "
next
 
dim prim$(1)
 
n = token(primes$, prim$())
 
for i = 1 to n
    sum = 0
    num$ = prim$(i)
    for j = 1 to len(num$)
        sum = sum + val(mid$(num$, j, 1))
    next
    if instr(primes$, str$(sum) + " ") print prim$(i), " "; : count = count + 1
next
 
print "\nFound: ", count