A193568 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 58.
38, 58, 73, 83, 116, 119, 161, 166, 191, 235, 253, 299, 307, 308, 325, 352, 357, 370, 375, 380, 468, 486, 489, 498, 523, 532, 537, 573, 611, 616, 648, 661, 679, 684, 697, 703, 730, 735, 753, 769, 796, 803, 830, 846, 849, 864, 894, 911, 929, 948, 967, 976
Offset: 1
Examples
468 is such a number of height 4 because it enters the cycle at 58 in 4 steps: 468 -> 116 -> 38 -> 73 -> 58 -> 89 -> 145 -> 42 -> 20 -> 4 -> 16 -> 37 -> 58 -> ...
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=58 then a:=[op(a),i] fi; od: print(op(a));