A193567 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 37.
3, 9, 18, 30, 33, 37, 39, 47, 56, 57, 59, 61, 65, 74, 75, 81, 90, 93, 95, 106, 108, 111, 114, 122, 125, 137, 138, 141, 144, 148, 152, 157, 158, 160, 173, 175, 178, 180, 183, 184, 185, 187, 212, 215, 221, 225, 227, 246, 251, 252, 256, 258, 264, 265, 272, 285
Offset: 1
Examples
568 is such a number of height 7 because it enters the cycle at 37 in 7 steps: 568 -> 125 -> 30 -> 9 -> 81 -> 65 -> 61 -> 37 -> 58 -> 89 -> 145 -> 42 -> 20 -> 4 -> 16 -> 37 -> ...
Links
- Eric Weisstein's World of Mathematics, Unhappy Number.
Programs
-
Maple
S:=proc(n) local Q,k,N,z; Q:=[n]; for k from 1 do N:=convert(Q[k],base,10); z:=sum(N['i']^2,'i'=1..nops(N)); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end: a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=37 then a:=[op(a),i] fi; od: print(op(a));