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.

Showing 1-8 of 8 results.

A014837 Sum of all the digits of n in every base from 2 to n-1.

Original entry on oeis.org

2, 3, 7, 9, 15, 16, 20, 24, 34, 33, 45, 51, 59, 57, 73, 72, 90, 91, 103, 113, 135, 127, 143, 155, 167, 170, 198, 192, 222, 220, 240, 256, 280, 260, 296, 314, 338, 332, 372, 366, 408, 415, 429, 451, 497, 471, 507, 514, 546, 555, 607, 597, 637, 633, 669, 697
Offset: 3

Views

Author

Keywords

Crossrefs

Cf. A043306.

Programs

  • Mathematica
    Table[Plus @@ Flatten[Table[IntegerDigits[n, b], {b, 2, n - 1}]], {n, 3, 36}] (* Alonso del Arte, Mar 28 2009 *)
  • Python
    from sympy.ntheory.digits import digits
    def a(n): return sum(sum(digits(n, b)[1:]) for b in range(2, n))
    print([a(n) for n in range(3, 59)]) # Michael S. Branicky, Apr 04 2022

Formula

a(n) = A043306(n) - 1. - Amiram Eldar, Apr 16 2021

A240236 Triangle read by rows: sum of digits of n in base k, for 2<=k<=n.

Original entry on oeis.org

1, 2, 1, 1, 2, 1, 2, 3, 2, 1, 2, 2, 3, 2, 1, 3, 3, 4, 3, 2, 1, 1, 4, 2, 4, 3, 2, 1, 2, 1, 3, 5, 4, 3, 2, 1, 2, 2, 4, 2, 5, 4, 3, 2, 1, 3, 3, 5, 3, 6, 5, 4, 3, 2, 1, 2, 2, 3, 4, 2, 6, 5, 4, 3, 2, 1, 3, 3, 4, 5, 3, 7, 6, 5, 4, 3, 2, 1, 3, 4, 5, 6, 4, 2, 7, 6, 5, 4, 3, 2, 1
Offset: 2

Views

Author

Keywords

Examples

			Triangle starts:
  1
  2 1
  1 2 1
  2 3 2 1
  2 2 3 2 1
  3 3 4 3 2 1
		

Crossrefs

Row sums give A043306.
See A138530 for another version.

Programs

  • Haskell
    a240236 n k = a240236_tabl !! (n-1) !! (k-1)
    a240236_row n = a240236_tabl !! (n-1)
    a240236_tabl = zipWith (map . flip q)
                           [2..] (map tail $ tail a002260_tabl) where
       q b n = if n < b then n else q b n' + d where (n', d) = divMod n b
    -- Reinhard Zumkeller, Apr 29 2015
  • Mathematica
    Table[Total[Flatten[IntegerDigits[n,k]]],{n,20},{k,2,n}]//Flatten (* Harvey P. Dale, Jan 13 2025 *)
  • PARI
    T(n,k) = local(r=0);if(k<2,-1,while(n>0,r+=n%k;n\=k);r)
    
  • PARI
    T(n, k) = sumdigits(n, k) \\ Zhuorui He, Aug 25 2025
    

Formula

T(n,k) = n - (k - 1) * Sum_{i=1..floor(log_k(n))} floor(n/k^i). - Ridouane Oudra, Sep 27 2024
T(n,k) = n - (k - 1) * A090623(n,k). - Zhuorui He, Aug 25 2025

A043000 Number of digits in all base-b representations of n, for 2 <= b <= n.

Original entry on oeis.org

2, 4, 7, 9, 11, 13, 16, 19, 21, 23, 25, 27, 29, 31, 35, 37, 39, 41, 43, 45, 47, 49, 51, 54, 56, 59, 61, 63, 65, 67, 70, 72, 74, 76, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126
Offset: 2

Views

Author

Keywords

Comments

From A.H.M. Smeets, Dec 14 2019: (Start)
a(n)-a(n-1) >= 2 due to the fact that n = 10_n, so there is an increment of at least 2. If n can be written as a perfect power m^s, an additional +1 comes to it for the representation of n in each base m.
For instance, for n = 729 we have 729 = 3^6 = 9^3 = 27^2, so there is an additional increment of 3. For n = 1296 we have 1296 = 6^4 = 36^2, so there is an additional increment of 2. For n = 4096 we have 4096 = 2^12 = 4^6 = 8^4 = 16^3= 64^2, so there is an additional increment of 5. (End)

Examples

			5 = 101_2 = 12_3 = 11_4 = 10_5. Thus a(5) = 3+2+2+2 = 9.
		

Crossrefs

Programs

  • Magma
    [&+[Floor(Log(i,i*n)):k in [2..n]]:n in [1..70]]; // Marius A. Burtea, Nov 13 2019
    
  • Maple
    A043000 := proc(n) add( nops(convert(n,base,b)),b=2..n) ; end proc: # R. J. Mathar, Jun 04 2011
  • Mathematica
    Table[Total[IntegerLength[n,Range[2,n]]],{n,2,60}] (* Harvey P. Dale, Apr 23 2019 *)
  • PARI
    a(n)=sum(b=2,n,#digits(n,b)) \\ Jeppe Stig Nielsen, Dec 14 2019
    
  • PARI
    a(n)= n-1 +sum(b=2,n,logint(n,b)) \\ Jeppe Stig Nielsen, Dec 14 2019
    
  • PARI
    a(n) = {2*n-2+sum(i=2, logint(n, 2), sqrtnint(n, i)-1)} \\ David A. Corneth, Dec 31 2019
    
  • PARI
    first(n) = my(res = vector(n)); res[1] = 2; for(i = 2, n, inc = numdiv(gcd(factor(i+1)[,2]))+1; res[i] = res[i-1]+inc); res \\ David A. Corneth, Dec 31 2019
  • Python
    def count(n,b):
        c = 0
        while n > 0:
            n, c = n//b, c+1
        return c
    n = 0
    while n < 50:
        n = n+1
        a, b = 0, 1
        while b < n:
            b = b+1
            a = a + count(n,b)
        print(n,a) # A.H.M. Smeets, Dec 14 2019
    

Formula

a(n) = Sum_{i=2..n} floor(log_i(i*n)); a(n) ~ 2*n. - Vladimir Shevelev, Jun 03 2011 [corrected by Vaclav Kotesovec, Apr 05 2021]
a(n) = A070939(n) + A081604(n) + A110591(n) + ... + 1. - R. J. Mathar, Jun 04 2011
From Ridouane Oudra, Nov 13 2019: (Start)
a(n) = Sum_{i=1..n-1} floor(n^(1/i));
a(n) = n - 1 + Sum_{i=1..floor(log_2(n))} floor(n^(1/i) - 1);
a(n) = n - 1 + A255165(n). (End)
If n is in A001597 then a(A001597(m)) - a(A001597(m)-1) = 2 + A253642(m), otherwise a(n) - a(n-1) = 2. - A.H.M. Smeets, Dec 14 2019

A131383 Total digital sum of n: sum of the digital sums of n for all the bases 1 to n (a 'digital sumorial').

Original entry on oeis.org

1, 3, 6, 8, 13, 16, 23, 25, 30, 35, 46, 46, 59, 66, 75, 74, 91, 91, 110, 112, 125, 136, 159, 152, 169, 182, 195, 199, 228, 223, 254, 253, 274, 291, 316, 297, 334, 353, 378, 373, 414, 409, 452, 460, 475, 498, 545, 520, 557, 565, 598, 608, 661, 652, 693, 690
Offset: 1

Views

Author

Hieronymus Fischer, Jul 05 2007, Jul 15 2007, Jan 07 2009

Keywords

Comments

Sums of rows of the triangle in A138530. - Reinhard Zumkeller, Mar 26 2008

Examples

			5 = 11111(base 1) = 101(base 2) = 12(base 3) = 11(base 4) = 10(base 5). Thus a(5) = ds_1(5)+ds_2(5)+ds_3(5)+ds_4(5)+ds_5(5) = 5+2+3+2+1 = 13.
		

Crossrefs

Programs

  • Mathematica
    Table[n + Total@ Map[Total@ IntegerDigits[n, #] &, Range[2, n]], {n, 56}] (* Michael De Vlieger, Jan 03 2017 *)
  • PARI
    a(n)=sum(i=2,n+1,vecsum(digits(n,i))); \\ R. J. Cano, Jan 03 2017

Formula

a(n) = n^2-sum{k>0, sum{2<=p<=n, (p-1)*floor(n/p^k)}}.
a(n) = n^2-sum{2<=p<=n, (p-1)*sum{0
a(n) = n^2-A024916(n)+A006218(n)-sum{k>1, sum{2<=p<=n, (p-1)*floor(n/p^k)}}.
a(n) = A004125(n)+A006218(n)-sum{k>1, sum{2<=p<=n, (p-1)*floor(n/p^k)}}.
Asymptotic behavior: a(n) = (1-Pi^2/12)*n^2 + O(n*log(n)) = A004125(n) + A006218(n) + O(n*log(n)).
Lim a(n)/n^2 = 1 - Pi^2/12 for n-->oo.
G.f.: (1/(1-x))*(x(1+x)/(1-x)^2-sum{k>0,sum{j>1,(j-1)*x^(j^k)/(1-x^(j^k))}= }).
Also: (1/(1-x))*(x(1+x)/(1-x)^2-sum{m>1, sum{10,j^(1/k) is an integer, j^(1/k)-1}}*x^m}).
a(n) = n^2-sum{10,sum{1
Recurrence: a(n)=a(n-1)-b(n)+2n-1, where b(n)=sum{1
a(n) = sum{1<=p<=n, ds_p(n)} where ds_p = digital sum base p.
a(n) = A043306(n) + n (that sequence ignores unary) = A014837(n) + n + 1 (that sequence ignores unary and base n in which n is "10"). - Alonso del Arte, Mar 26 2009

A309531 a(n) = Sum_{k=2..n} (-1)^k * A240236(n, k).

Original entry on oeis.org

1, 1, 0, 0, 2, 2, -3, 1, 5, 5, -2, -2, 4, 10, -6, -6, 1, 1, -8, 0, 10, 10, -16, -8, 4, 18, 7, 7, 13, 13, -19, -7, 9, 19, -11, -11, 7, 21, -15, -15, -5, -5, -20, 10, 32, 32, -36, -24, -1, 17, 0, 0, 18, 32, -14, 6, 34, 34, -23, -23, 7, 45, -29, -13, 5, 5, -16, 8, 30, 30, -66
Offset: 2

Author

Seiichi Manyama, Aug 06 2019

Keywords

Examples

			a(2) = 1.
a(3) = 2 - 1 = 1.
a(4) = 1 - 2 + 1 = 0.
a(5) = 2 - 3 + 2 - 1 = 0.
a(6) = 2 - 2 + 3 - 2 + 1 = 2.
		

Crossrefs

Programs

  • PARI
    {a(n) = sum(k=2, n, (-1)^k*sumdigits(n, k))}

Formula

a(n) = a(n-1) if and only if n is an odd prime.

A043544 Numbers k such that s(k)

Original entry on oeis.org

12, 16, 18, 24, 30, 32, 36, 40, 42, 48, 54, 56, 60, 64, 66, 72, 78, 80, 84, 90, 96, 100, 102, 108, 112, 114, 120, 126, 128, 132, 138, 140, 144, 150, 156, 160, 162, 168, 174, 176, 180, 186, 192, 196, 198, 200, 204, 208, 210, 216, 220
Offset: 1

Keywords

Crossrefs

Cf. A043306.

Formula

A = {k: A043306(k) < A043306(k - 1)}. - Sean A. Irvine, Mar 09 2021

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

Original entry on oeis.org

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

Author

Alex Ratushnyak, Jul 08 2014

Keywords

Examples

			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.
		

Crossrefs

Cf. A004125 (sum of last digits), A043306 (sum of all digits).

Programs

  • Mathematica
    f[n_] := Sum[ IntegerDigits[n, k][[1]], {k, 2, n}]; Array[f, 70, 2] (* Robert G. Wilson v, Aug 02 2014 *)
  • PARI
    a(n) = sum(i=2, n, digits(n, i)[1]); \\ Michel Marcus, Jul 17 2014
  • Python
    import math
    def modlg(a, b):
        return a // b**int(math.log(a, b))
    for n in range(2,77):
        s=0
        for k in range(2,n+1):
            s += modlg(n,k)
        print(s, end=', ')
    

Formula

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

A343481 a(n) is the sum of all digits of n in every prime base 2 <= p <= n.

Original entry on oeis.org

1, 3, 3, 6, 6, 10, 11, 11, 10, 15, 16, 22, 21, 21, 23, 30, 32, 40, 42, 42, 39, 48, 52, 53, 49, 52, 53, 63, 66, 77, 83, 82, 76, 77, 82, 94, 87, 85, 90, 103, 107, 121, 123, 129, 120, 135, 144, 147, 153, 150, 151, 167, 176, 178, 185, 181, 168, 185, 194, 212, 199
Offset: 2

Author

Amiram Eldar, Apr 16 2021

Keywords

Examples

			a(5) = 6 since in the prime bases 2, 3 and 5 the representations of 5 are 101_2, 12_3 and 10_5, respectively, and (1 + 0 + 1) + (1 + 2) + (1 + 0) = 6.
		

Crossrefs

Programs

  • Mathematica
    s[n_, b_] := Plus @@ IntegerDigits[n, b]; ps[n_] := Select[Range[n], PrimeQ]; a[n_] := Sum[s[n, b], {b, ps[n]}]; Array[a, 100, 2]
  • PARI
    a(n) = sum(b=2, n, if (isprime(b), sumdigits(n, b))); \\ Michel Marcus, Apr 17 2021

Formula

a(n) ~ (1-Pi^2/12)*n^2/log(n) + c*n^2/log(n)^2 + o(n^2/log(n)^2), where c = 1 - Pi^2/24 + zeta'(2)/2 = 1 - A222171 - (1/2)*A073002 = 0.1199923561... (Fissum, 2020).
Showing 1-8 of 8 results.