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.

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

This page as a plain text file.
%I A193570 #22 Feb 16 2025 08:33:15
%S A193570 77,98,145,149,194,238,283,289,298,328,358,382,385,419,456,465,491,
%T A193570 538,546,564,583,645,654,678,687,707,768,770,786,789,798,809,823,829,
%U A193570 832,835,853,867,876,879,890,892,897,908,914,928,941,978,980,982,987
%N A193570 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 145.
%H A193570 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/UnhappyNumber.html">Unhappy Number</a>.
%e A193570 25889 is such a number of height 4 because it enters the cycle at 145 in 4 steps: 25889 -> 238 -> 77 -> 98 -> 145 -> 42 -> 20 -> 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> ...
%p A193570 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 A193570 a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=145 then a:=[op(a),i] fi; od: print(op(a));
%Y A193570 Cf. A031177, A039943.
%K A193570 nonn,base
%O A193570 1,1
%A A193570 _Martin Renner_, Jul 31 2011