← RoseCode

ROSECODE 022

Happy Primes

elasolova · Programming ·

A happy number is built by adding the squares of its digits. Doing this permanently, the numbers will end in 1 or 4.

If a positive integer ends with 1, then it is a happy number.

The first few happy prime numbers are:

7, 13, 19, 23, 31, 79, 97, 103, 109 ...

What is the sum of the first 30,000 happy prime numbers?