# The Magical 1 and 42

I stumbled upon a really cool mathematical anomaly that is easy to understand and can be appreciated by almost anyone.

The game begins by starting with any whole number greater than zero. To illustrate, let’s choose my birth year of 1977.

Now, we will create a sequence from this number in the following way.

Add up the square of the digits of your number for the next number in the sequence.

Since $1^2+9^2+7^2+7^2 = 1+81+49+49=180$, this is the next number in the sequence.  The next number?  Well, $1^2+8^2+0^2 = 1+64=65$, so 65 is the next number in the sequence.  Here are the next several:

• $6^2+5^2=36+25 = 61$
• $6^2+1^2 = 36+1=37$
• $3^2+7^2=9+49=58$
• $5^2+8^2=25+64=89$
• $8^2+9^2=64+81=145$
• $1^2+4^2+5^2=1+16+25=42$

42!  I got to 42!

Can you believe that if you form sequences in this manner, every number will either end at 1 or at 42?  Indeed, about 14-15% of the whole numbers will end at 1, while the other 85-86% will end at 42.

Try it for yourself!

To be a little more precise, there is nothing special about 42.  You could name any of the following numbers that result from 42 coming back to itself:

• $4^2+2^2=16+4=20$
• $2^2+0^2=4$
• $4^2 = 16$
• $1^2+6^2=1+36 = 37$
• $3^2+7^2=9+49=58$
• $5^2+8^2 = 25+64 = 89$
• $8^2+9^2=64+81=145$
• $1^2+4^2+5^2=1+16+25=42$

About 85-86% of the whole numbers will get trapped in this loop.  But 42 is the coolest, since it is the answer to the great question of Life, the Universe, and Everything. Perhaps we’ve stumbled upon the great question?

If you create a sequence beginning with any whole number greater than zero by adding up the squares of the digits of the number each time, what number other than 1 will the sequence converge to?

For a fun example of one that converges to 1, let’s go with my high school graduation year of 1995:

• $1^2+9^2+9^2+5^2=1+81+81+25=188$
• $1^2+8^2+8^2=1+64+64=129$
• $1^2+2^2+9^2=1+4+81=86$
• $8^2+6^2=64+36=100$
• $1^2+0^2+0^2=1$

Want to take this challenge to an extreme level? Try Problem 92 on Project Euler.