sexta-feira, maio 30, 2008

happy and unhappy numbers!

Posted by with 1 comment

"A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers. A computer search up to 1020 suggests that about 12% of decimal numbers are happy[1], though no proof is known (Guy 2004:§E34)."

fonte: wikipedia




Provando:
44 * 44 = 1936
1 + 81 + 9 + 36 = 127
1+ 4 +49 = 54
25 + 16 = 41
16 + 1 = 17
1 + 49= 50
25
4 + 25 = 29
4 + 81 = 85
64 + 25 = 89
64 + 81 = 145
1 + 16+ 25 = 42
16 + 4 = 20
4
16
1+ 36 = 37
9 + 49 = 58
25 + 64 = 89
64 + 81 = 145
1 + 16+ 25 = 42
16 + 4 = 20

4
16
1+ 36 = 37
9 + 49 = 58
25 + 64 = 89
64 + 81 = 145
1+ 16 + 25 = 42
16 + 4 = 20
4
...
e continua...unhappy mente!
Sugere-se que apenas 12% dos numeros decimais são happy numbers!
Reacções:

1 comentários:

Jorge CR disse...

Fantástico, Djinho.

Gosto. Muito. Deste tipo de coisas...
Obrigado

Jorge CR