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

A014473 Pascal's triangle - 1: Triangle read by rows: T(n, k) = A007318(n, k) - 1.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 3, 5, 3, 0, 0, 4, 9, 9, 4, 0, 0, 5, 14, 19, 14, 5, 0, 0, 6, 20, 34, 34, 20, 6, 0, 0, 7, 27, 55, 69, 55, 27, 7, 0, 0, 8, 35, 83, 125, 125, 83, 35, 8, 0, 0, 9, 44, 119, 209, 251, 209, 119, 44, 9, 0, 0, 10, 54, 164, 329, 461, 461, 329, 164, 54, 10, 0
Offset: 0

Views

Author

Keywords

Comments

Indexed as a square array A(n,k): If X is an (n+k)-set and Y a fixed k-subset of X then A(n,k) is equal to the number of n-subsets of X intersecting Y. - Peter Luschny, Apr 20 2012

Examples

			Triangle begins:
   0;
   0, 0;
   0, 1,  0;
   0, 2,  2,  0;
   0, 3,  5,  3,  0;
   0, 4,  9,  9,  4,  0;
   0, 5, 14, 19, 14,  5, 0;
   0, 6, 20, 34, 34, 20, 6, 0;
   ...
Seen as a square array read by antidiagonals:
  [0] 0, 0,  0,  0,   0,   0,   0,    0,    0,    0,    0,     0, ... A000004
  [1] 0, 1,  2,  3,   4,   5,   6,    7,    8,    9,   10,    11, ... A001477
  [2] 0, 2,  5,  9,  14,  20,  27,   35,   44,   54,   65,    77, ... A000096
  [3] 0, 3,  9, 19,  34,  55,  83,  119,  164,  219,  285,   363, ... A062748
  [4] 0, 4, 14, 34,  69, 125, 209,  329,  494,  714, 1000,  1364, ... A063258
  [5] 0, 5, 20, 55, 125, 251, 461,  791, 1286, 2001, 3002,  4367, ... A062988
  [6] 0, 6, 27, 83, 209, 461, 923, 1715, 3002, 5004, 8007, 12375, ... A124089
		

Crossrefs

Triangle without zeros: A014430.
Related: A323211 (A007318(n, k) + 1).
A000295 (row sums), A059841 (alternating row sums), A030662(n-1) (central terms).
Columns include A000096, A062748, A062988, A063258.
Diagonals of A(n, n+d): A030662 (d=0), A010763 (d=1), A322938 (d=2).

Programs

  • Haskell
    a014473 n k = a014473_tabl !! n !! k
    a014473_row n = a014473_tabl !! n
    a014473_tabl = map (map (subtract 1)) a007318_tabl
    -- Reinhard Zumkeller, Apr 10 2012
    
  • Magma
    [Binomial(n,k)-1: k in [0..n], n in [0..12]]; // G. C. Greubel, Apr 08 2024
    
  • Maple
    with(combstruct): for n from 0 to 11 do seq(-1+count(Combination(n), size=m), m = 0 .. n) od; # Zerinvary Lajos, Apr 09 2008
    # The rows of the square array:
    Arow := proc(n, len) local gf, ser;
    gf := (x - 1)^(-n - 1) + (-1)^(n + 1)/(x*(x - 1));
    ser := series(gf, x, len+2): seq((-1)^(n+1)*coeff(ser, x, j), j=0..len) end:
    for n from 0 to 9 do lprint([n], Arow(n, 12)) od; # Peter Luschny, Feb 13 2019
  • Mathematica
    Table[Binomial[n,k] -1, {n,0,12}, {k,0,n}]//Flatten (* G. C. Greubel, Apr 08 2024 *)
  • SageMath
    flatten([[binomial(n,k)-1 for k in range(n+1)] for n in range(13)]) # G. C. Greubel, Apr 08 2024

Formula

G.f.: x^2*y/((1 - x)*(1 - x*y)*(1 - x*(1 + y))). - Ralf Stephan, Jan 24 2005
T(n,k) = A109128(n,k) - A007318(n,k), 0 <= k <= n. - Reinhard Zumkeller, Apr 10 2012
T(n, k) = T(n-1, k-1) + T(n-1, k) + 1, 0 < k < n with T(n, 0) = T(n, n) = 0. - Reinhard Zumkeller, Jul 18 2015
If seen as a square array read by antidiagonals the generating function of row n is: G(n) = (x - 1)^(-n - 1) + (-1)^(n + 1)/(x*(x - 1)). - Peter Luschny, Feb 13 2019
From G. C. Greubel, Apr 08 2024: (Start)
T(n, n-k) = T(n, k).
Sum_{k=0..floor(n/2)} T(n-k, k) = A129696(n-2).
Sum_{k=0..floor(n/2)} (-1)^k*T(n-k, k) = b(n-1), where b(n) is the repeating pattern {0, 0, -1, -2, -1, 1, 1, -1, -2, -1, 0, 0}_{n=0..11}, with b(n) = b(n-12). (End)

Extensions

More terms from Erich Friedman

A323227 a(n) = [x^n] (1 - 2*x + x^2 - 2*x^3 + x^4)/((1 - x)^2*(1 - 2*x)).

Original entry on oeis.org

1, 2, 4, 6, 9, 14, 23, 40, 73, 138, 267, 524, 1037, 2062, 4111, 8208, 16401, 32786, 65555, 131092, 262165, 524310, 1048599, 2097176, 4194329, 8388634, 16777243, 33554460, 67108893, 134217758, 268435487, 536870944, 1073741857, 2147483682, 4294967331, 8589934628
Offset: 0

Views

Author

Peter Luschny, Feb 12 2019

Keywords

Crossrefs

Programs

  • Magma
    [n le 1 select n+1 else 2^(n-2) +(n+1) : n in [0..35]]; // G. C. Greubel, Sep 26 2024
    
  • Maple
    a := proc(n) option remember; if n < 4 then return [1, 2, 4, 6][n + 1] fi;
    ((2 - 2*n)*a(n-2) - (5 - 3*n)*a(n-1))/(n - 2) end: seq(a(n), n=0..35);
  • Mathematica
    A323211[n_, k_] := If[n <= 1, 1, Binomial[n - 2, k - 1] + 1];
    Table[Sum[A323211[n, k], {k, 0, n}], {n, 0, 35}]
  • SageMath
    [2^(n-2) +(n+1) -int(n==0)/4 -int(n==1)/2 for n in range(36)] # G. C. Greubel, Sep 26 2024

Formula

a(n) = Sum_{k=0..n} ( binomial(n - 2, k - 1) + 1 ), if n >= 2.
a(n) = ((2 - 2*n)*a(n-2) - (5 - 3*n)*a(n-1))/(n - 2) for n >= 4.
a(n+1) - (n + 1) = A094373(n) for n >= 0.
a(n+1) - a(n) = 2^n + 1 for n >= 2.
a(n) = A270841(n) = 2^(n-2)+n+1 for n>=2. - R. J. Mathar, Feb 14 2019
E.g.f.: (1/4)*(-(1 + 2*x) + 4*(1+x)*exp(x) + exp(2*x)). - G. C. Greubel, Sep 26 2024

A323231 A(n, k) = [x^k] (1/(1-x) + x/(1-x)^n), square array read by descending antidiagonals for n, k >= 0.

Original entry on oeis.org

1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 3, 2, 1, 1, 2, 4, 4, 2, 1, 1, 2, 5, 7, 5, 2, 1, 1, 2, 6, 11, 11, 6, 2, 1, 1, 2, 7, 16, 21, 16, 7, 2, 1, 1, 2, 8, 22, 36, 36, 22, 8, 2, 1, 1, 2, 9, 29, 57, 71, 57, 29, 9, 2, 1, 1, 2, 10, 37, 85, 127, 127, 85, 37, 10, 2, 1
Offset: 0

Views

Author

Peter Luschny, Feb 10 2019

Keywords

Examples

			Array starts:
[0] 1, 2,  1,  1,   1,   1,    1,    1,    1,     1,     1, ...
[1] 1, 2,  2,  2,   2,   2,    2,    2,    2,     2,     2, ... A040000
[2] 1, 2,  3,  4,   5,   6,    7,    8,    9,    10,    11, ... A000027
[3] 1, 2,  4,  7,  11,  16,   22,   29,   37,    46,    56, ... A000124
[4] 1, 2,  5, 11,  21,  36,   57,   85,  121,   166,   221, ... A050407
[5] 1, 2,  6, 16,  36,  71,  127,  211,  331,   496,   716, ... A145126
[6] 1, 2,  7, 22,  57, 127,  253,  463,  793,  1288,  2003, ... A323228
[7] 1, 2,  8, 29,  85, 211,  463,  925, 1717,  3004,  5006, ...
[8] 1, 2,  9, 37, 121, 331,  793, 1717, 3433,  6436, 11441, ...
[9] 1, 2, 10, 46, 166, 496, 1288, 3004, 6436, 12871, 24311, ...
.
Read as a triangle (by descending antidiagonals):
                                     1
                                  2,   1
                                1,   2,   1
                             1,   2,   2,   1
                           1,   2,   3,   2,   1
                        1,   2,   4,   4,   2,   1
                      1,   2,   5,   7,   5,   2,  1
                    1,  2,   6,  11,  11,   6,   2,  1
                  1,  2,   7,  16,  21,  16,   7,  2,  1
                1,  2,  8,  22,  36,  36,  22,   8,  2,  1
              1,  2,  9,  29,  57,  71,  57,  29,  9,  2,  1
.
A(0, 1) = C(-1, 0) + 1 = 2 because C(-1, 0) = 1. A(1, 0) = C(-1, -1) + 1 = 1 because C(-1, -1) = 0. Warning: Some computer algebra programs (for example Maple and Mathematica) return C(n, n) = 1 for n < 0. This contradicts the definition given by Graham et al. (see reference). On the other hand this definition preserves symmetry.
		

References

  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990, p. 154.

Crossrefs

Differs from A323211 only in the second term.
Diagonals A(n, n+d): A323230 (d=0), A260878 (d=1), A323229 (d=2).
Antidiagonal sums are A323227(n) if n!=1.
Cf. A007318 (Pascal's triangle).

Programs

  • Julia
    using AbstractAlgebra
    function Arow(n, len)
        R, x = PowerSeriesRing(ZZ, len+2, "x")
        gf = inv(1-x) + divexact(x, (1-x)^n)
        [coeff(gf, k) for k in 0:len-1] end
    for n in 0:9 println(Arow(n, 11)) end
  • Maple
    Binomial := (n, k) -> `if`(n < 0 and n = k, 0, binomial(n,k)):
    A := (n, k) -> Binomial(n + k - 2, k - 1) + 1:
    seq(lprint(seq(A(n, k), k=0..10)), n=0..10);
  • Mathematica
    T[n_, k_]:= If[k==0, 1 + Boole[n==1], If[k==n, 1, Binomial[n-2, k-1] + 1]];
    Table[T[n, k], {n,0,15}, {k,0,n}]//Flatten (* G. C. Greubel, Dec 27 2021 *)
  • Sage
    def Arow(n):
        R. = PowerSeriesRing(ZZ, 20)
        gf = 1/(1-x) + x/(1-x)^n
        return gf.padded_list(10)
    for n in (0..9): print(Arow(n))
    

Formula

A(n, k) = binomial(n + k - 2, k - 1) + 1. Note that binomial(n, n) = 0 if n < 0.
A(n, k) = A(k, n) with the exception A(1,0) != A(0,1).
A(n, n) = binomial(2*n-2, n-1) + 1 = A323230(n).
From G. C. Greubel, Dec 27 2021: (Start)
T(n, k) = binomial(n-2, k-1) + 1 with T(n, 0) = 1 + [n=1], T(n, n) = 1.
T(2*n, n) = A323230(n).
Sum_{k=0..n} T(n,k) = n + 1 + 2^(n-2) - [n=0]/4 + [n=1]/2. (End)
Showing 1-3 of 3 results.