I was doing a program where I had to figure out whether the sum of square of digits of a number will ultimately give $1$. For eg: $$68 \;\to\; 6^2+8^2=36+64=100 \;\to\; 1^2+0^2+0^2=1$$
So I wanted to know if this loop gives a single digit number ultimately for every number.
Let S(x) be the sum of the squares of the digits of x. You first find T = largest number x so that S(x) >= x. Obviously starting with an x > T will end up with an integer <= T. You can show that T = 99. So you examine all numbers up to 99 and check which cycle they end in.