OFFSET
1,1
REFERENCES
David Wells, The Penguin Dictionary of Curious and Interesting Numbers, p. 154 (Rev. ed. 1997).
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Happy Number
EXAMPLE
7480 is included because 7480, 7481 and 7482 are all happy numbers.
MATHEMATICA
happyQ[n_] := Nest[Plus @@(IntegerDigits[ # ]^2\)&, n, 50] == 1); Transpose[Select[Partition[Select[Range[50000], happyQ], 3, 1], #[[3]] - #[[2]] == #[[2]] - #[[1]] == 1 &]][[1]]
f[n_] := Total[IntegerDigits[n]^2]; t = Select[Range[50000], NestWhile[f, #, UnsameQ, All] == 1 &]; t[[Select[Range[Length[t] - 2], t[[#]] == t[[# + 1]] - 1 == t[[# + 2]] - 2 &]]] (* T. D. Noe, Aug 23 2011 *)
SequencePosition[Table[If[FixedPoint[Total[IntegerDigits[#]^2]&, n, 100]==1, 1, 0], {n, 45000}], {1, 1, 1}][[All, 1]] (* Harvey P. Dale, Jun 19 2022 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Harvey P. Dale, Aug 02 2002
STATUS
approved