login
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