login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

For any n > 0, let b > 1 be the least base where the sum of digits of n divides n; a(n) is the sum of digits of n in base b.
2

%I #9 Sep 19 2022 07:23:21

%S 1,1,1,1,1,2,1,1,1,2,1,2,1,2,3,1,1,2,1,2,3,2,1,2,5,2,1,2,1,2,1,1,3,2,

%T 5,2,1,2,3,2,1,3,1,4,3,2,1,2,1,5,3,4,1,2,5,4,3,2,1,4,1,2,3,1,5,2,1,2,

%U 3,10,1,2,1,2,5,4,7,6,1,2,3,2,1,3,5,2,3

%N For any n > 0, let b > 1 be the least base where the sum of digits of n divides n; a(n) is the sum of digits of n in base b.

%C See A356552 for the corresponding bases.

%H Amiram Eldar, <a href="/A356553/b356553.txt">Table of n, a(n) for n = 1..10000</a>

%e For n = 14:

%e - we have:

%e b sum of digits divides 14?

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

%e 2 3 no

%e 3 4 no

%e 4 5 no

%e 5 6 no

%e 6 4 no

%e 7 2 yes

%e - so a(14) = 2.

%t a[n_] := Module[{b = 2}, While[!Divisible[n, (s = Plus @@ IntegerDigits[n, b])], b++]; s]; Array[a, 100] (* _Amiram Eldar_, Sep 19 2022 *)

%o (PARI) a(n) = { for (b=2, oo, my (s=sumdigits(n, b)); if (n % s==0, return (s))) }

%o (Python)

%o from sympy.ntheory import digits

%o def a(n):

%o b = 2

%o while n != 0 and n%sum(digits(n, b)[1:]): b += 1

%o return sum(digits(n, b)[1:])

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

%Y Cf. A356552.

%K nonn,base

%O 1,6

%A _Rémy Sigrist_, Aug 12 2022