25 lines
1.0 KiB
Plaintext
25 lines
1.0 KiB
Plaintext
From Wikipedia, the free encyclopedia:
|
|
:: A [[wp:Happy number|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'''.
|
|
<br>
|
|
|
|
:: Those numbers for which this process end in '''1''' are ''happy'' numbers,
|
|
:: while those numbers that do <u>not</u> end in '''1''' are ''unhappy'' numbers.
|
|
|
|
|
|
;Task:
|
|
Find and print the first '''8''' happy numbers.
|
|
|
|
Display an example of your output here on this page.
|
|
|
|
|
|
;Related tasks:
|
|
* [[Iterated digits squaring]]
|
|
|
|
;See also:
|
|
* The OEIS entry: [[oeis:A007770|The happy numbers: A007770]]
|
|
* The OEIS entry: [[oeis:A031177|The unhappy numbers; A031177]]
|
|
<br><br>
|
|
|