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-7 of 7 results.

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

Views

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.

A309431 a(n) = Sum_{k=2..p} (-1)^k * A240236(p, k), where p is n-th prime.

Original entry on oeis.org

1, 1, 0, 2, 5, -2, -6, 1, 10, 7, 13, -11, -15, -5, 32, 0, 34, -23, 5, 30, -66, 33, 29, -18, -60, -17, 13, 69, -21, -65, 65, 17, 8, 50, -6, 24, -33, -23, 130, 13, 115, -93, 184, -132, 4, 48, -11, 31, 70, -99, -23, 192, -258, 154, -68, 155, -18, 16, -35, -101, -11
Offset: 1

Views

Author

Seiichi Manyama, Aug 06 2019

Keywords

Crossrefs

Programs

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

Formula

a(n) = A309531(A000040(n)).

A138530 Triangle read by rows: T(n,k) = sum of digits of n in base k representation, 1<=k<=n.

Original entry on oeis.org

1, 2, 1, 3, 2, 1, 4, 1, 2, 1, 5, 2, 3, 2, 1, 6, 2, 2, 3, 2, 1, 7, 3, 3, 4, 3, 2, 1, 8, 1, 4, 2, 4, 3, 2, 1, 9, 2, 1, 3, 5, 4, 3, 2, 1, 10, 2, 2, 4, 2, 5, 4, 3, 2, 1, 11, 3, 3, 5, 3, 6, 5, 4, 3, 2, 1, 12, 2, 2, 3, 4, 2, 6, 5, 4, 3, 2, 1, 13, 3, 3, 4, 5, 3, 7, 6, 5, 4, 3, 2, 1, 14, 3, 4, 5, 6, 4, 2, 7, 6, 5, 4, 3, 2, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 26 2008

Keywords

Comments

A131383(n) = sum of n-th row;
A000027(n) = T(n,1);
A000120(n) = T(n,2) for n>1;
A053735(n) = T(n,3) for n>2;
A053737(n) = T(n,4) for n>3;
A053824(n) = T(n,5) for n>4;
A053827(n) = T(n,6) for n>5;
A053828(n) = T(n,7) for n>6;
A053829(n) = T(n,8) for n>7;
A053830(n) = T(n,9) for n>8;
A007953(n) = T(n,10) for n>9;
A053831(n) = T(n,11) for n>10;
A053832(n) = T(n,12) for n>11;
A053833(n) = T(n,13) for n>12;
A053834(n) = T(n,14) for n>13;
A053835(n) = T(n,15) for n>14;
A053836(n) = T(n,16) for n>15;
A007395(n) = T(n,n-1) for n>1;
A000012(n) = T(n,n).

Examples

			Start of the triangle for n in base k representation:
......................1
....................11....10
......... ........111....11...10
................1111...100...11..10
..............11111...101...12..11..10
............111111...110...20..12..11..10
..........1111111...111...21..13..12..11..10
........11111111..1000...22..20..13..12..11..10
......111111111..1001..100..21..14..13..12..11..10
....1111111111..1010..101..22..20..14..13..12..11..10
..11111111111..1011..102..23..21..15..14..13..12..11..10
111111111111..1100..110..30..22..20..15..14..13..12..11..10,
and the triangle of sums of digits starts:
......................1
.....................2...1
......... ..........3...2...1
...................4...1...2...1
..................5...2...3...2...1
.................6...2...2...3...2...1
................7...3...3...4...3...2...1
...............8...1...4...2...4...3...2...1
..............9...2...1...3...5...4...3...2...1
............10...2...2...4...2...5...4...3...2...1
...........11...3...3...5...3...6...5...4...3...2...1
..........12...2...2...3...4...2...6...5...4...3...2...1.
		

Crossrefs

Cf. A007953. See A240236 for another version.
Cf. A002260.

Programs

  • Haskell
    a138530 n k = a138530_tabl !! (n-1) !! (k-1)
    a138530_row n = a138530_tabl !! (n-1)
    a138530_tabl = zipWith (map . flip q) [1..] a002260_tabl where
       q 1 n = n
       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
    T[n_, k_] := If[k == 1, n, Total[IntegerDigits[n, k]]];
    Table[T[n, k], {n, 1, 14}, {k, 1, n}] // Flatten (* Jean-François Alcover, Oct 25 2021 *)

A144912 Unreduced numerators of digital mean, dm_num(b, n), with rows n in {2, 3, 4, ...} and columns b in {2, 3, 4, ..., n}.

Original entry on oeis.org

0, 2, -2, -1, 0, -4, 1, 2, -2, -6, 1, 0, 0, -4, -8, 3, 2, 2, -2, -6, -10, -2, 4, -2, 0, -4, -8, -12, 0, -4, 0, 2, -2, -6, -10, -14, 0, -2, 2, -4, 0, -4, -8, -12, -16, 2, 0, 4, -2, 2, -2, -6, -10, -14, -18, 0, -2, 0, 0, -6, 0, -4, -8, -12, -16, -20
Offset: 2

Views

Author

Reikku Kulon, Sep 25 2008, Oct 03 2008

Keywords

Comments

The unreduced numerator of dm(b, n) is Sum_{i=1..d} (2*d_i - (b-1)), where d is the number of digits in the base b representation of n and d_i the individual digits. The corresponding denominator is 2 * d, giving a value in (-(b - 1) / 2, (b - 1) / 2] for n > 0.
dm_num(b, n) = d(b - 1) iff all the digits in n are b - 1.
dm_num(b, n) = -2(b - 2) for b = n, because n in base n is 10, giving dm_num(n, n) = 2 - n + 1 + 0 - n + 1 = 4 - 2 * n = -2(n - 2).
dm_num(b, n) = 0 for odd b and n having all digits equal to (b - 1) / 2, as well as for many other (b, n).
Defining m = ceiling((n + 1) / 2):
dm_num(b, n) = dm_num(b - 1, n) - 4 for b in [m + 1, n].
dm_num(m, n) = 0 for even n and 2 for odd n.
dm_num(m - 1, n) = 6 - n for even n > 4 and 9 - n for odd n > 5, producing a sequence of first differences {+2, -4, +2, -4, ...}.
Triangular patterns become clearly visible for large n, defined by additive periodicities along rational slopes. Zeros along the triangle borders correspond to ones in the Redheffer matrix until odd values become dominant. The line along m is the border between the two largest triangles. This pattern is masked by aliasing effects for small bases, notably including base 10, due to the thinness of the triangles which dominate at small b. Odd values may represent "artifacts" caused by "interference".

Examples

			Triangle begins:
   0;
   2, -2;
  -1,  0, -4;
   1,  2, -2, -6;
   1,  0,  0, -4, -8;
   3,  2,  2, -2, -6, -10;
   ...
		

Crossrefs

Programs

  • Mathematica
    dmnum[b_,n_]:=2Total[IntegerDigits[n,b]]-(b-1)Floor[Log[b,n*b]]; (* after Jinyuan Wang *)
    Table[dmnum[b,n],{n,2,10},{b,2,n}] (* Paolo Xausa, Sep 26 2023 *)
  • PARI
    dm(b, n) = 2*sumdigits(n, b) - (b-1)*logint(n*b, b); \\ Jinyuan Wang, Jul 21 2020

A043306 Sum of all digits in all base-b representations for n, for 2 <= b <= n.

Original entry on oeis.org

1, 3, 4, 8, 10, 16, 17, 21, 25, 35, 34, 46, 52, 60, 58, 74, 73, 91, 92, 104, 114, 136, 128, 144, 156, 168, 171, 199, 193, 223, 221, 241, 257, 281, 261, 297, 315, 339, 333, 373, 367, 409, 416, 430, 452, 498, 472, 508, 515, 547, 556, 608, 598, 638, 634, 670, 698, 756, 717, 777
Offset: 2

Views

Author

Keywords

Examples

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

Crossrefs

Programs

  • Mathematica
    Table[Sum[Total[First[RealDigits[n, i]]], {i, 2, n}], {n, 2, 80}] (* Carl Najafi, Aug 16 2011 *)
  • PARI
    a(n) = sum(i=2, n, vecsum(digits(n, i))); \\ Michel Marcus, Jan 03 2017
    
  • PARI
    a(n) = sum(b=2, n, sumdigits(n, b)); \\ Michel Marcus, Aug 18 2017
    
  • Python
    from sympy.ntheory.digits import digits
    def a(n): return sum(sum(digits(n, b)[1:]) for b in range(2, n+1))
    print([a(n) for n in range(2, 62)]) # Michael S. Branicky, Apr 04 2022

Formula

From Vladimir Shevelev, Jun 03 2011: (Start)
a(n) = (n-1)*n - Sum_{i=2..n} (i-1)*Sum_{r>=1} floor(n/i^r).
a(n) <= (n-1)^2*log(n+1)/log(n).
Problem: find a better upper estimate. (End)
From Amiram Eldar, Apr 16 2021: (Start)
a(n) = A014837(n) + 1.
a(n) ~ (1-Pi^2/12)*n^2 + O(n^(3/2)) (Fissum, 2020). (End)

A090623 Triangle of T(n,k) = [n/k] + [n/k^2] + [n/k^3] + [n/k^4] + ... for n, k > 1.

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 4, 2, 1, 1, 1, 4, 2, 1, 1, 1, 1, 7, 2, 2, 1, 1, 1, 1, 7, 4, 2, 1, 1, 1, 1, 1, 8, 4, 2, 2, 1, 1, 1, 1, 1, 8, 4, 2, 2, 1, 1, 1, 1, 1, 1, 10, 5, 3, 2, 2, 1, 1, 1, 1, 1, 1, 10, 5, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 11, 5, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 11, 6, 3, 3, 2, 2, 1, 1, 1
Offset: 2

Views

Author

Henry Bottomley, Dec 06 2003

Keywords

Examples

			Rows start:
  1;
  1,1;
  3,1,1;
  3,1,1,1;
  4,2,1,1,1;
  4,2,1,1,1,1;
  7,2,2,1,1,1,1;
  7,4,2,1,1,1,1,1;
  8,4,2,2,1,1,1,1,1;
  ...
		

Crossrefs

Programs

  • Mathematica
    A090623[n_, k_] := Quotient[n - DigitSum[n, k], k - 1];
    Table[A090623[n, k], {n, 2, 15}, {k, 2, n}] (* Paolo Xausa, Sep 02 2025 *)
  • PARI
    T(n,k) = {my(s = 0, j = 1); while(p=n\k^j, s += p; j++); s;} \\ Michel Marcus, Feb 02 2016
    
  • PARI
    T(n,k) = (n - sumdigits(n,k))/(k-1) \\ Zhuorui He, Aug 25 2025

Formula

For p prime, T(n, p) = A090622(n, p) is the number of times that p is a factor of n!.
T(n,k) = (n - A240236(n, k))/(k - 1). - Zhuorui He, Aug 25 2025

Extensions

a(41) onward corrected by Zhuorui He, Aug 25 2025

A356517 Square array A(n, k), n >= 2, k >= 0, read by antidiagonals upwards; A(n, k) is the least integer with sum of digits k in base n.

Original entry on oeis.org

0, 0, 1, 0, 1, 3, 0, 1, 2, 7, 0, 1, 2, 5, 15, 0, 1, 2, 3, 8, 31, 0, 1, 2, 3, 7, 17, 63, 0, 1, 2, 3, 4, 11, 26, 127, 0, 1, 2, 3, 4, 9, 15, 53, 255, 0, 1, 2, 3, 4, 5, 14, 31, 80, 511, 0, 1, 2, 3, 4, 5, 11, 19, 47, 161, 1023, 0, 1, 2, 3, 4, 5, 6, 17, 24, 63, 242, 2047
Offset: 2

Views

Author

Rémy Sigrist, Aug 10 2022

Keywords

Comments

The expansion of A(n, k) in base n is:
q n-1 ... n-1
<- p times ->
where q = k mod (n-1) and p = floor(k / (n-1)).

Examples

			Array A(n, k) begins:
  n\k|  0  1  2  3   4   5   6    7    8    9    10    11    12
  ---+---------------------------------------------------------
    2|  0  1  3  7  15  31  63  127  255  511  1023  2047  4095
    3|  0  1  2  5   8  17  26   53   80  161   242   485   728
    4|  0  1  2  3   7  11  15   31   47   63   127   191   255
    5|  0  1  2  3   4   9  14   19   24   49    74    99   124
    6|  0  1  2  3   4   5  11   17   23   29    35    71   107
    7|  0  1  2  3   4   5   6   13   20   27    34    41    48
    8|  0  1  2  3   4   5   6    7   15   23    31    39    47
    9|  0  1  2  3   4   5   6    7    8   17    26    35    44
   10|  0  1  2  3   4   5   6    7    8    9    19    29    39
Array A(n, k) begins (with values given in base n):
  n\k|  0  1   2    3     4      5       6        7         8          9
  ---+------------------------------------------------------------------
    2|  0  1  11  111  1111  11111  111111  1111111  11111111  111111111
    3|  0  1   2   12    22    122     222     1222      2222      12222
    4|  0  1   2    3    13     23      33      133       233        333
    5|  0  1   2    3     4     14      24       34        44        144
    6|  0  1   2    3     4      5      15       25        35         45
    7|  0  1   2    3     4      5       6       16        26         36
    8|  0  1   2    3     4      5       6        7        17         27
    9|  0  1   2    3     4      5       6        7         8         18
   10|  0  1   2    3     4      5       6        7         8          9
		

Crossrefs

Programs

  • PARI
    A(n,k) = { (1+k%(n-1))*n^(k\(n-1))-1 }
    
  • Python
    def A(n,k): return (1+(k % (n-1)))*n**(k//(n-1))-1

Formula

A(2, k) = 2^k - 1.
A(3, k) = A062318(k+1).
A(4, k) = A180516(k+1).
A(5, k) = A181287(k+1).
A(6, k) = A181288(k+1).
A(7, k) = A181303(k+1).
A(8, k) = A165804(k+1).
A(9, k) = A140576(k+1).
A(10, k) = A051885(k).
A(n, 0) = 0.
A(n, 1) = 1.
A(n, k) = k iff k < n.
A(n, n) = 2*n - 1.
A(n, n+1) = 3*n - 1 for any n > 2.
Showing 1-7 of 7 results.