login
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).
1
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, 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, 3, 6, 6, 6, 7, 2, 4, 5, 3, 3, 5, 4, 6, 4, 4, 3, 7, 2
OFFSET
0,3
COMMENTS
The initial number counts as iteration 1.
FORMULA
a(n) <= A193995(n) with equality if and only if n is a Happy number (A007770).
a(n) = 1 if and only if n is in A039943.
a(n) = A099645(n)+1.
PROG
(Python)
def A364682(n):
c = 1
while n not in {0, 1, 37, 58, 89, 145, 42, 20, 4, 16}:
n = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(n))
c += 1
return c
CROSSREFS
KEYWORD
nonn
AUTHOR
Chai Wah Wu, Aug 02 2023
STATUS
approved