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.

A364682 Number of iterations of the "x -> sum of squares of digits of x" map (A003132) for n to converge to either 0, 1 or the 8-cycle (37,58,89,145,42,20,4,16).

This page as a plain text file.
%I A364682 #15 Aug 03 2023 04:18:33
%S A364682 1,1,2,6,1,5,10,6,6,5,2,3,6,3,7,4,1,6,4,5,1,6,7,4,2,4,3,7,4,3,6,3,4,5,
%T A364682 5,6,9,1,3,6,2,7,1,5,5,8,5,4,7,5,5,4,4,6,8,6,3,5,1,3,10,2,3,9,5,3,8,3,
%U A364682 3,6,6,6,7,2,4,5,3,3,5,4,6,4,4,3,7,2
%N A364682 Number of iterations of the "x -> sum of squares of digits of x" map (A003132) for n to converge to either 0, 1 or the 8-cycle (37,58,89,145,42,20,4,16).
%C A364682 The initial number counts as iteration 1.
%H A364682 Chai Wah Wu, <a href="/A364682/b364682.txt">Table of n, a(n) for n = 0..10000</a>
%F A364682 a(n) <= A193995(n) with equality if and only if n is a Happy number (A007770).
%F A364682 a(n) = 1 if and only if n is in A039943.
%F A364682 a(n) = A099645(n)+1.
%o A364682 (Python)
%o A364682 def A364682(n):
%o A364682     c = 1
%o A364682     while n not in {0,1,37,58,89,145,42,20,4,16}:
%o A364682         n = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(n))
%o A364682         c += 1
%o A364682     return c
%Y A364682 Cf. A003132, A007770, A039943, A099645, A193995.
%K A364682 nonn
%O A364682 0,3
%A A364682 _Chai Wah Wu_, Aug 02 2023