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.


get "libhdr"
manifest $( limit = 500 $) 
 
let dsum(n) = 
    n=0 -> 0,
    dsum(n/10) + n rem 10
 
let sieve(prime, n) be
$(  0!prime := false
    1!prime := false
    for i=2 to n do i!prime := true
    for i=2 to n/2
        if i!prime 
        $(  let j=i+i
            while j<=n
            $(  j!prime := false
                j := j+i
            $)
        $)
$)
 
let additive(prime, n) = n!prime & dsum(n)!prime
 
let start() be
$(  let prime = vec limit
    let num = 0
    sieve(prime, limit)
    for i=2 to limit
        if additive(prime,i)
        $(  writed(i,5)
            num := num + 1
            if num rem 10 = 0 then wrch('*N')
        $)
    writef("*N*NFound %N additive primes < %N.*N", num, limit)
$)