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.

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

This page as a plain text file.
%I A193571 #18 Feb 16 2025 08:33:15
%S A193571 42,154,389,398,415,451,514,541,839,893,938,983,1045,1054,1126,1162,
%T A193571 1216,1261,1344,1405,1434,1443,1450,1504,1540,1588,1612,1621,1669,
%U A193571 1696,1858,1885,1966,2116,2161,2235,2253,2325,2352,2523,2532,2611,3089,3098,3144
%N A193571 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 42.
%H A193571 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/UnhappyNumber.html">Unhappy Number</a>.
%e A193571 389 is such a number of height 2 because it enters the cycle at 42 in 2 steps: 389 -> 154 -> 42 -> 20 -> 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> 42 -> ...
%p A193571 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 A193571 a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=42 then a:=[op(a),i] fi; od: print(op(a));
%Y A193571 Cf. A031177, A039943.
%K A193571 nonn,base
%O A193571 1,1
%A A193571 _Martin Renner_, Jul 31 2011