This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A356553 #9 Sep 19 2022 07:23:21 %S A356553 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 A356553 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 A356553 3,10,1,2,1,2,5,4,7,6,1,2,3,2,1,3,5,2,3 %N A356553 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 A356553 See A356552 for the corresponding bases. %H A356553 Amiram Eldar, <a href="/A356553/b356553.txt">Table of n, a(n) for n = 1..10000</a> %e A356553 For n = 14: %e A356553 - we have: %e A356553 b sum of digits divides 14? %e A356553 -- ------------- ----------- %e A356553 2 3 no %e A356553 3 4 no %e A356553 4 5 no %e A356553 5 6 no %e A356553 6 4 no %e A356553 7 2 yes %e A356553 - so a(14) = 2. %t A356553 a[n_] := Module[{b = 2}, While[!Divisible[n, (s = Plus @@ IntegerDigits[n, b])], b++]; s]; Array[a, 100] (* _Amiram Eldar_, Sep 19 2022 *) %o A356553 (PARI) a(n) = { for (b=2, oo, my (s=sumdigits(n, b)); if (n % s==0, return (s))) } %o A356553 (Python) %o A356553 from sympy.ntheory import digits %o A356553 def a(n): %o A356553 b = 2 %o A356553 while n != 0 and n%sum(digits(n, b)[1:]): b += 1 %o A356553 return sum(digits(n, b)[1:]) %o A356553 print([a(n) for n in range(1, 88)]) # _Michael S. Branicky_, Aug 12 2022 %Y A356553 Cf. A356552. %K A356553 nonn,base %O A356553 1,6 %A A356553 _Rémy Sigrist_, Aug 12 2022