A357823 a(n) is the number of bases > 1 where n is not divisible by the sum of its digits.
0, 0, 1, 0, 3, 0, 5, 1, 4, 3, 9, 1, 11, 9, 7, 5, 15, 5, 17, 7, 11, 17, 21, 5, 18, 20, 17, 14, 27, 12, 29, 16, 24, 28, 24, 13, 35, 33, 31, 17, 39, 22, 41, 33, 26, 41, 45, 18, 42, 34, 42, 38, 51, 33, 45, 35, 48, 53, 57, 26, 59, 57, 44, 41, 52, 43, 65, 56, 60, 48
Offset: 1
Examples
For n = 10, we have: b sum of digits divisible? ---- ------------- ---------- 2 2 Yes 3 2 Yes 4 4 No 5 2 Yes 6 5 Yes 7 4 No 8 3 No 9 2 Yes 10 1 Yes >=11 10 Yes so a(n) = #{ 4, 7, 8 } = 3.
Programs
-
Mathematica
NivenQ[n_, b_] := Divisible[n, Total @ IntegerDigits[n, b]]; a[n_] := Sum[Boole @ !NivenQ[n, b], {b, 2, n}]; Array[a, 70]
-
PARI
a(n) = sum(b=2, n, n%sumdigits(n,b)!=0)
-
Python
from sympy.ntheory.factor_ import digits def A357823(n): return sum(1 for b in range(2,n) if n%sum(digits(n,b)[1:])) # Chai Wah Wu, Oct 19 2022
Formula
a(n) = n - A080221(n).
a(p) = p - 2 for any prime number p.
Comments