Happy prime

According to the Tenth Doctor, a happy prime was any number which was both happy and prime. He went on to describe a : "Any number that reduces to one when you take the sum of the square of its digits and continue iterating it until it yields 1 is a happy number, any number that doesn't, isn't."

- Tenth Doctor

When the SS Pentallian hurtled towards the Torajii sun, Riley Vashtee and Martha Jones used the happy prime sequence of 313, 331, 367 and 379 to reach the ship's back-up engines, with help from the Tenth Doctor.

The Doctor bemoaned Riley and Martha's lack of knowledge about happy primes and wondered why there appeared to be falling standards in the education of what he called recreational mathematics. (TV: 42).