Happy Number

A Happy Number is one where the repeated process of squaring and adding the digits eventually gives an answer of 1.

For example: 13

• $13->1^{2}+3^{2}=1+9=10$
• $10->1^{2}+0^{2}=1$
• $1->1^2=1$ ... and so on.
If a sequence like this reaches 1 it will stay there. 13 is a Happy Number!

However some numbers do not reach one. For example: 14

• $14->1^{2}+4^{2}=1+16=17$
• $17->1^{2}+7^{2}=1+49=50$
• $50->5^{2}+0^{2}=25$
• $25->2^{2}+5^{2}=4+25=29$
• $29->2^{2}+9^{2}=4+81=85$
• $85->8^{2}+5^{2}=64+25=89$
• $89->8^{2}+9^{2}=64+81=145$
• $145->1^{2}+4^{2}+5^{2}=1+16+25=42$
• $42->4^{2}+2^{2}=16+4=20$
• $20->2^{2}+0^{2}=4$
• $4->4^{2}=16$
• $16->1^{2}+6^{2}=1+36=37$
• $37->3^{2}+7^{2}=9+49=58$
• $58->5^{2}+8^{2}=25+64=89$
which we've seen before...

14 is an Unhappy Number.

This procedure is an example of a Number Chain