OFFSET
1,5
COMMENTS
The sequence is well defined as the sum of digits of n equals n (and hence divides n) in any base > n.
FORMULA
a(n) = n - A080221(n).
a(p) = p - 2 for any prime number p.
EXAMPLE
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.
MATHEMATICA
NivenQ[n_, b_] := Divisible[n, Total @ IntegerDigits[n, b]]; a[n_] := Sum[Boole @ !NivenQ[n, b], {b, 2, n}]; Array[a, 70]
PROG
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 17 2022
STATUS
approved