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.


func IsPrime(N);        \Return 'true' if N is a prime number
int  N, I;
[if N <= 1 then return false;
for I:= 2 to sqrt(N) do
    if rem(N/I) = 0 then return false;
return true;
];
 
func SumDigits(N);      \Return the sum of the digits in N
int     N, Sum;
[Sum:= 0;
repeat  N:= N/10;
        Sum:= Sum + rem(0);
until   N=0;
return Sum;
];
 
int Count, N;
[Count:= 0;
for N:= 0 to 500-1 do
    if IsPrime(N) & IsPrime(SumDigits(N)) then
        [IntOut(0, N);
        Count:= Count+1;
        if rem(Count/10) = 0 then CrLf(0) else ChOut(0, 9\tab\);
        ];
CrLf(0);
IntOut(0, Count);
Text(0, " additive primes found below 500.
");
]