[go: up one dir, main page]

login
A014841
Sum modulo the base of all the digits of n in every base from 2 to n-1.
6
0, 3, 2, 7, 6, 13, 13, 18, 19, 31, 24, 37, 40, 48, 48, 65, 59, 79, 76, 85, 93, 117, 105, 121, 132, 148, 143, 176, 163, 193, 191, 208, 226, 250, 225, 262, 277, 302, 290, 332, 320, 359, 363, 376, 394, 444, 419, 455, 462, 491, 495, 551, 540, 577, 564, 601, 625
OFFSET
3,2
LINKS
MATHEMATICA
Table[Sum[Mod[Total[IntegerDigits[n, i]], i], {i, 2, n-1}], {n, 3, 59}] (* Stefano Spezia, Sep 06 2022 *)
PROG
(PARI) a(n) = sum(b=2, n-1, sumdigits(n, b) % b); \\ Michel Marcus, Sep 06 2022
(Python)
from sympy.ntheory import digits
def a(n): return sum(sum(digits(n, b)[1:])%b for b in range(2, n))
print([a(n) for n in range(3, 60)]) # Michael S. Branicky, Sep 06 2022
KEYWORD
nonn,base
STATUS
approved