OFFSET
0,1
COMMENTS
FORMULA
EXAMPLE
Under iterations of A348783, 0 -> 1 -> 10 -> 11 -> 20 -> 101 -> 21 -> 110 -> 21 -> ..., so the cycle (21, 110) is reached after a(0) = 6 iterations, and also a(1) = 5, a(10) = 4, a(11) = 3, a(20) = 2, a(101) = 1 and a(21) = a(110) = 0 because these two are elements of this cycle.
Similarly, 2 -> 100 -> 12 -> 110 -> 21 -> ..., so the same cycle is reached in a(2) = 3 iterations, and also a(100) = 2, a(12) = 1.
Then, 3 -> 1000 -> 13 -> 1010 -> 22 -> 200 -> 102 -> 111 -> 30 -> 1001 -> 22 -> 200 -> ..., here the cycle (22, 200, 102, 111, 30, 1001) is reached after a(3) = 4 iterations, and a(1000) = 3, a(13) = 2, a(1010) = 1 and a(n) = 0 for the elements of that cycle.
PROG
(PARI) apply( {A349249(n, S=[n], T)=while(!setsearch(S, n=A348783(n)), S=setunion(S, [n])); if(T, T-#S, A349249(n, , #S))}, [0..99])
(Python)
def f(n):
s = str(n)
return int("".join(str(s.count(d)) for d in "9876543210").lstrip("0"))
def a(n):
orbit, fn = [n], f(n)
while fn not in orbit:
orbit.append(fn)
n, fn = fn, f(fn)
return orbit.index(fn)
print([a(n) for n in range(77)]) # Michael S. Branicky, Nov 18 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Nov 17 2021
STATUS
approved