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.


#lang racket
 
(require math/number-theory)
 
(define (sum-of-digits n (σ 0))
  (if (zero? n) σ (let-values (((q r) (quotient/remainder n 10)))
                    (sum-of-digits q (+ σ r)))))
 
(define (additive-prime? n)
  (and (prime? n) (prime? (sum-of-digits n))))
 
(define additive-primes<500 (filter additive-prime? (range 1 500)))
(printf "There are ~a additive primes < 500~%" (length additive-primes<500))
(printf "They are: ~a~%" additive-primes<500)