OFFSET
1,5
EXAMPLE
For n = 11, we have:
b sum of digits remainder
---- ------------- ---------
2 3 2
3 3 2
4 5 1
5 3 2
6 6 5
7 5 1
8 4 3
9 3 2
10 2 1
11 1 0
>=12 11 0
so a(11) = 5.
PROG
(PARI) a(n) = { my (mx=0); for (b=2, n, mx=max(mx, n%sumdigits(n, b))); return (mx); }
(Python)
from sympy.ntheory import digits
def a(n): return max((n%sum(digits(n, b)[1:]) for b in range(2, n+1)), default=0)
print([a(n) for n in range(1, 72)]) # Michael S. Branicky, Oct 17 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 17 2022
STATUS
approved