Why does a sequence of unhappy numbers always loop back to itself? Given a positive integer $19$, it is said to be happy, because $1^2 + 9^2 = 82$, $8^2+2^2 = 68$, $6^2 + 8^2 = 100$, $1^2 + 0^2 + 0^2 = 1$. At each step we simply sum the square of all its digits, and if at some step the sum is equal to $1$, then we say this number is happy, otherwise unhappy. It is true that for an unhappy number $n$, it will always loop back to itself. Why is this true?

Hint: for any number greater than 99 the sum of the squared digits is less than the number. So either the sequence terminates at 1, or the sequence gets trapped in a loop. Then with a little more effort one can show that the only loop is  4 -16 - 37 - 58 - 89 - 145 - 42 - 20 - 4.
