login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A244912
Sum of leading digit in representations of n in bases 2,3,...,n.
1
1, 2, 3, 4, 6, 7, 9, 9, 11, 12, 15, 16, 18, 20, 20, 21, 25, 26, 29, 31, 33, 34, 38, 36, 38, 39, 42, 43, 47, 48, 52, 54, 56, 58, 58, 59, 61, 63, 67, 68, 72, 73, 76, 79, 81, 82, 88, 84, 88, 90, 93, 94, 99, 101, 105, 107, 109, 110, 116, 117, 119, 122, 117, 119, 123
OFFSET
2,2
LINKS
EXAMPLE
8 in bases 2...8 is:
1000 (base 2)
22 (base 3)
20 (base 4)
13 (base 5)
12 (base 6)
11 (base 7)
10 (base 8)
The sum of first digits is 1+2+2+1+1+1+1 = 9, so a(8)=9.
MATHEMATICA
f[n_] := Sum[ IntegerDigits[n, k][[1]], {k, 2, n}]; Array[f, 70, 2] (* Robert G. Wilson v, Aug 02 2014 *)
PROG
(Python)
import math
def modlg(a, b):
....return a // b**int(math.log(a, b))
for n in range(1, 77):
....s=0
....for k in range(2, n+1):
........s += modlg(n, k)
....print str(s)+', ',
(PARI) a(n) = sum(i=2, n, digits(n, i)[1]); \\ Michel Marcus, Jul 17 2014
CROSSREFS
Cf. A004125 (sum of last digits), A043306 (sum of all digits).
Sequence in context: A132988 A363997 A342760 * A249745 A114956 A039256
KEYWORD
nonn,base
AUTHOR
Alex Ratushnyak, Jul 08 2014
STATUS
approved