login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A193572
Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 20.
0
20, 24, 204, 224, 240, 242, 402, 420, 422, 1133, 1313, 1331, 2004, 2024, 2040, 2042, 2204, 2240, 2400, 2402, 2420, 3113, 3131, 3311, 4002, 4020, 4022, 4200, 4202, 4220, 4899, 4989, 4998, 5779, 5797, 5977, 7579, 7597, 7759, 7795, 7957, 7975, 8499, 8949, 8994
OFFSET
1,1
LINKS
Eric Weisstein's World of Mathematics, Unhappy Number.
EXAMPLE
4899 is such a number of height 3 because it enters the cycle at 20 in 3 steps: 4899 -> 242 -> 24 -> 20 -> 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> 42 -> 20 -> ...
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=20 then a:=[op(a), i] fi; od: print(op(a));
CROSSREFS
Sequence in context: A263016 A107302 A219392 * A167323 A112819 A070684
KEYWORD
nonn,base
AUTHOR
Martin Renner, Jul 31 2011
STATUS
approved