OFFSET
1,6
COMMENTS
The procedure is guaranteed to reach 1 because n in base n is 10, and its reversal is 01 = 1.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
Michael S. Branicky, Alternate Python programs for A378562
EXAMPLE
For n = 13, the a(13) = 4 steps in the trajectory to 1 are 13 -> 11 -> 7 -> 5 -> 1.
PROG
(Python) # see links for other versions
from functools import cache
from sympy.ntheory import digits
def fd(t, b): return sum(t[-1-i]*b**i for i in range(len(t)))
def f(n): return next(fd(r, b) for b in range(2, n+1) if (s:=digits(n, b)[1:]) > (r:=s[::-1]))
@cache
def a(n): return 0 if n == 1 else 1 + a(f(n))
print([a(n) for n in range(1, 88)]) # Michael S. Branicky, Dec 01 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Asier Rodriguez Escalante, Nov 30 2024
STATUS
approved