A368342 Sum of digits of the numbers 0..n-1 in factorial base (A108731).
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
Examples
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.
Links
- Kevin Ryde, Table of n, a(n) for n = 0..10000
- 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.
- Index entries for sequences related to factorial base representation.
Crossrefs
Programs
-
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 *)
-
PARI
\\ See links.
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).
Comments