Happy number

From Tardis Wiki, the free Doctor Who reference
Happy number

According to the Tenth Doctor, a happy number was "any number that reduces to 1 when you take the sum of the square of its digits and continue iterating it until it yields 1... any number that doesn't, isn't". Four such happy numbers (which were also prime numbers) were 313, 331, 367 and 379.

He discussed this rule when helping Martha Jones answer a quiz question about a sequence of happy prime numbers, numbers which are both happy and prime. He momentarily criticised her and the other humans present for their lack of understanding, expressing concern schools no longer taught recreational mathematics. (TV: 42)