## Tuesday, July 16, 2013

### 1390 (313+331+367+379)

In the 2007 Doctor Who episode "42", a sequence of happy primes (313, 331, 367, 379) is used as a code for unlocking a sealed door on a spaceship about to collide with a star. When the Doctor learns that nobody on the spaceship besides himself has heard of happy numbers, he asks, "Don't they teach recreational mathematics anymore?"

A prime number is a number with exactly 2 factors - itself and 1.

A happy number is a number that, when you square each digit and add the squares together, and keep doing that, eventually you get 1.
.....For example, the number 379 is happy:
.....square each digit - 3 squared is 9, 7 squared is 49, 9 squared is 81.
.....add the squares together:  9+49+81 = 139
.....repeat - 1 squared is 1, 3 squared is 9, 9 squared is 81.  1+9+81 = 91
.....repeat - 9 squared is 81, 1 squared is 1.  81+1 = 82
.....repeat - 8 squared is 64,  2 squared is 4.  64+4 = 68
.....repeat - 6 squared is 36, 8 squared is 64.  36+64 = 100
.....repeat - 1 squared is 1, 0 squared is 0, 0 squared is 0.  1+0+0 = 1
.....Eventually you get to 1.

313, 331, 367, 379 are all happy primes.

They add up to 1390, which is a happy number, but is not prime.