login
A368342
Sum of digits of the numbers 0..n-1 in factorial base (A108731).
3
0, 0, 1, 2, 4, 6, 9, 10, 12, 14, 17, 20, 24, 26, 29, 32, 36, 40, 45, 48, 52, 56, 61, 66, 72, 73, 75, 77, 80, 83, 87, 89, 92, 95, 99, 103, 108, 111, 115, 119, 124, 129, 135, 139, 144, 149, 155, 161, 168, 170, 173, 176, 180, 184, 189, 192, 196, 200, 205, 210, 216
OFFSET
0,4
COMMENTS
Trollope considers sums of digits in a mixed-radix representation and the present sequence is a(n) = Trollope's A(n) for the case xi_i = i+1.
LINKS
Kevin Ryde, PARI/GP Code.
J. R. Trollope, Generalized Bases and Digital Sums, American Mathematical Monthly, volume 74, number 6, July 1967, pp. 690-694.
FORMULA
a(n) = Sum_{i=0..n-1} A034968(i).
a(n) = Sum_{j=1..k} d[j] * (s(j) + d[j]/2 + (j-2)*(j+1)/4) * j!, where d[j] = A301652(n,j) are the factorial-base digits n = Sum_{j=1..k} d[j]*j!, where k = A084558(n), and digit sum s(j) = Sum_{i=j+1..k} d[i].
a(n) ~ (1/4)*n*k^2 where k = A084558(n), from the j=k term in the above sum.
a(n) = a(n-k!) + n-k! + k!*k*(k-1)/4, for k! <= n < (k+1)!, which is k = A084558(n).
a(k!) = k! * k*(k-1)/4 = A001809(k).
EXAMPLE
For n=8, the factorial-base representations of 0..7 are 0, 1, 10, 11, 20, 21, 100, 101 and their total sum of digits is a(8) = 12.
MATHEMATICA
s[n_] := Module[{k = n, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0 || r != 0, AppendTo[s, r]; m++]; Total[s]]; Join[{0}, Accumulate[Array[s, 100, 0]]] (* Amiram Eldar, Mar 11 2024 *)
PROG
(PARI) \\ See links.
CROSSREFS
Cf. A007623, A108731 (factorial base), A301652 (reversed), A084558 (length), A034968 (digit sum).
Cf. A001809.
Sequence in context: A156165 A024968 A047411 * A288623 A138972 A050110
KEYWORD
nonn,base,easy
AUTHOR
Kevin Ryde, Dec 30 2023
STATUS
approved