cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A244912 Sum of leading digits in representations of n in bases 2,3,...,n.

This page as a plain text file.
%I A244912 #50 Apr 28 2025 12:18:55
%S A244912 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,
%T A244912 39,42,43,47,48,52,54,56,58,58,59,61,63,67,68,72,73,76,79,81,82,88,84,
%U A244912 88,90,93,94,99,101,105,107,109,110,116,117,119,122,117,119,123
%N A244912 Sum of leading digits in representations of n in bases 2,3,...,n.
%H A244912 Jens Kruse Andersen, <a href="/A244912/b244912.txt">Table of n, a(n) for n = 2..1000</a>
%F A244912 a(n) = Sum_{k=2..n} floor(n/f(n,k)), with f(n,k) = k^floor(log_k(n)). - _Ridouane Oudra_, Apr 26 2025
%e A244912 8 in bases 2...8 is:
%e A244912   1000 (base 2)
%e A244912   22 (base 3)
%e A244912   20 (base 4)
%e A244912   13 (base 5)
%e A244912   12 (base 6)
%e A244912   11 (base 7)
%e A244912   10 (base 8)
%e A244912 The sum of first digits is 1+2+2+1+1+1+1 = 9, so a(8)=9.
%t A244912 f[n_] := Sum[ IntegerDigits[n, k][[1]], {k, 2, n}]; Array[f, 70, 2] (* _Robert G. Wilson v_, Aug 02 2014 *)
%o A244912 (Python)
%o A244912 import math
%o A244912 def modlg(a, b):
%o A244912     return a // b**int(math.log(a, b))
%o A244912 for n in range(2,77):
%o A244912     s=0
%o A244912     for k in range(2,n+1):
%o A244912         s += modlg(n,k)
%o A244912     print(s, end=', ')
%o A244912 (PARI) a(n) = sum(i=2, n, digits(n, i)[1]); \\ _Michel Marcus_, Jul 17 2014
%Y A244912 Cf. A004125 (sum of last digits), A043306 (sum of all digits).
%K A244912 nonn,base
%O A244912 2,2
%A A244912 _Alex Ratushnyak_, Jul 08 2014