login
For any n >= 0, let x_n(1) = n, and for any b > 1, x_n(b) is the sum of digits of x_n(b-1) in base b; x_n is eventually constant, with value a(n).
1

%I #7 Aug 12 2022 12:37:31

%S 0,1,1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,3,1,2,

%T 2,1,2,1,1,2,2,1,1,2,1,2,2,3,2,1,1,2,1,2,2,3,1,2,2,3,2,3,3,2,1,2,2,1,

%U 2,1,1,2,2,1,1,2,1,2,2,3,2,1,1,2,1,2,2

%N For any n >= 0, let x_n(1) = n, and for any b > 1, x_n(b) is the sum of digits of x_n(b-1) in base b; x_n is eventually constant, with value a(n).

%C This sequence is unbounded (see also A356516).

%F a(2*n) = a(n).

%e For n = 87:

%e - we have:

%e b x_87(b) x_87(b) in base b+1

%e --- ------- -------------------

%e 1 87 "1010111"

%e 2 5 "12"

%e >=3 3 "3"

%e - so a(87) = 3.

%o (PARI) a(n) = { for (b=2, oo, if (n<b, return (n), n=sumdigits(n,b))) }

%o (Python)

%o from sympy.ntheory import digits

%o def a(n):

%o xn, b = n, 2

%o while xn >= b: xn = sum(digits(xn, b)[1:]); b += 1

%o return xn

%o print([a(n) for n in range(105)]) # _Michael S. Branicky_, Aug 10 2022

%Y Cf. A000120, A053735, A356384, A356516.

%K nonn,base,easy

%O 0,4

%A _Rémy Sigrist_, Aug 09 2022