cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A193572 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 20.

This page as a plain text file.
%I A193572 #18 Feb 16 2025 08:33:15
%S A193572 20,24,204,224,240,242,402,420,422,1133,1313,1331,2004,2024,2040,2042,
%T A193572 2204,2240,2400,2402,2420,3113,3131,3311,4002,4020,4022,4200,4202,
%U A193572 4220,4899,4989,4998,5779,5797,5977,7579,7597,7759,7795,7957,7975,8499,8949,8994
%N A193572 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 20.
%H A193572 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/UnhappyNumber.html">Unhappy Number</a>.
%e A193572 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 -> ...
%p A193572 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:
%p A193572 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));
%Y A193572 Cf. A031177, A039943.
%K A193572 nonn,base
%O A193572 1,1
%A A193572 _Martin Renner_, Jul 31 2011