login
A193565
Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 4.
0
2, 4, 11, 78, 87, 101, 110, 113, 131, 168, 179, 186, 197, 200, 249, 257, 259, 275, 294, 295, 311, 429, 449, 467, 476, 492, 494, 527, 529, 559, 567, 572, 576, 592, 595, 618, 647, 657, 674, 675, 681, 708, 719, 725, 746, 752, 756, 764, 765, 779, 780, 791, 797
OFFSET
1,1
LINKS
Eric Weisstein's World of Mathematics, Unhappy Number.
EXAMPLE
7899 is such a number of height 6 because it enters the cycle at 4 in 6 steps: 7899 -> 275 -> 78 -> 113 -> 11 -> 2 -> 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> 42 -> 20 -> 4 -> ...
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=4 then a:=[op(a), i] fi; od: print(op(a));
CROSSREFS
Sequence in context: A182100 A327484 A006894 * A198864 A038093 A057284
KEYWORD
nonn,base
AUTHOR
Martin Renner, Jul 31 2011
STATUS
approved