A193995 Maximum number of terms required to determine whether a number is happy or not (A007770 or A031177).
1, 9, 13, 8, 12, 17, 6, 13, 12, 2, 10, 13, 3, 14, 11, 8, 13, 11, 5, 8, 13, 14, 4, 9, 11, 10, 14, 4, 10, 13, 3, 4, 12, 12, 13, 16, 8, 10, 13, 9, 14, 8, 12, 5, 15, 12, 11, 14, 5, 12, 11, 11, 13, 15, 13, 10, 12, 8, 10, 17, 9, 10, 16, 12, 10, 15, 10, 3, 13, 6
Offset: 1
Examples
For n=2, a(n)=9 because the iterations are 2, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16,...
Links
- T. D. Noe, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
f[n_] := Total[IntegerDigits[n]^2]; Table[Length[NestWhileList[f, n, UnsameQ, All]] - 1, {n, 100}]
Comments