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

A228196 A triangle formed like Pascal's triangle, but with n^2 on the left border and 2^n on the right border instead of 1.

Original entry on oeis.org

0, 1, 2, 4, 3, 4, 9, 7, 7, 8, 16, 16, 14, 15, 16, 25, 32, 30, 29, 31, 32, 36, 57, 62, 59, 60, 63, 64, 49, 93, 119, 121, 119, 123, 127, 128, 64, 142, 212, 240, 240, 242, 250, 255, 256, 81, 206, 354, 452, 480, 482, 492, 505, 511, 512, 100, 287, 560, 806, 932, 962, 974, 997, 1016, 1023, 1024
Offset: 1

Views

Author

Boris Putievskiy, Aug 15 2013

Keywords

Comments

The third row is (n^4 - n^2 + 24*n + 24)/12.
For a closed-form formula for generalized Pascal's triangle see A228576. - Boris Putievskiy, Sep 04 2013

Examples

			The start of the sequence as a triangular array read by rows:
   0;
   1,  2;
   4,  3,  4;
   9,  7,  7,  8;
  16, 16, 14, 15, 16;
  25, 32, 30, 29, 31, 32;
  36, 57, 62, 59, 60, 63, 64;
		

Crossrefs

Cf. We denote Pascal-like triangle with L(n) on the left border and R(n) on the right border by (L(n),R(n)). A007318 (1,1), A008949 (1,2^n), A029600 (2,3), A029618 (3,2), A029635 (1,2), A029653 (2,1), A037027 (Fibonacci(n),1), A051601 (n,n) n>=0, A051597 (n,n) n>0, A051666 (n^2,n^2), A071919 (1,0), A074829 (Fibonacci(n), Fibonacci(n)), A074909 (1,n), A093560 (3,1), A093561 (4,1), A093562 (5,1), A093563 (6,1), A093564 (7,1), A093565 (8,1), A093644 (9,1), A093645 (10,1), A095660 (1,3), A095666 (1,4), A096940 (1,5), A096956 (1,6), A106516 (3^n,1), A108561(1,(-1)^n), A132200 (4,4), A134636 (2n+1,2n+1), A137688 (2^n,2^n), A160760 (3^(n-1),1), A164844(1,10^n), A164847 (100^n,1), A164855 (101*100^n,1), A164866 (101^n,1), A172171 (1,9), A172185 (9,11), A172283 (-9,11), A177954 (int(n/2),1), A193820 (1,2^n), A214292 (n,-n), A227074 (4^n,4^n), A227075 (3^n,3^n), A227076 (5^n,5^n), A227550 (n!,n!), A228053 ((-1)^n,(-1)^n), A228074 (Fibonacci(n), n).
Cf. A000290 (row 1), A153056 (row 2), A000079 (column 1), A000225 (column 2), A132753 (column 3), A118885 (row sums of triangle array + 1), A228576 (generalized Pascal's triangle).

Programs

  • GAP
    T:= function(n,k)
        if k=0 then return n^2;
        elif k=n then return 2^n;
        else return T(n-1,k-1) + T(n-1,k);
        fi;
      end;
    Flat(List([0..12], n-> List([0..n], k-> T(n,k) ))); # G. C. Greubel, Nov 12 2019
  • Maple
    T:= proc(n, k) option remember;
          if k=0 then n^2
        elif k=n then 2^k
        else T(n-1, k-1) + T(n-1, k)
          fi
        end:
    seq(seq(T(n, k), k=0..n), n=0..10); # G. C. Greubel, Nov 12 2019
  • Mathematica
    T[n_, k_]:= T[n, k] = If[k==0, n^2, If[k==n, 2^k, T[n-1, k-1] + T[n-1, k]]]; Table[T[n, k], {n,0,10}, {k,0,n}]//Flatten (* G. C. Greubel, Nov 12 2019 *)
    Flatten[Table[Sum[i^2 Binomial[n-1-i, n-k-i], {i,1,n-k}] + Sum[2^i Binomial[n-1-i, k-i], {i,1,k}], {n,0,10}, {k,0,n}]] (* Greg Dresden, Aug 06 2022 *)
  • PARI
    T(n,k) = if(k==0, n^2, if(k==n, 2^k, T(n-1, k-1) + T(n-1, k) )); \\ G. C. Greubel, Nov 12 2019
    
  • Python
    def funcL(n):
       q = n**2
       return q
    def funcR(n):
       q = 2**n
       return q
    for n in range (1,9871):
       t=int((math.sqrt(8*n-7) - 1)/ 2)
       i=n-t*(t+1)/2-1
       j=(t*t+3*t+4)/2-n-1
       sum1=0
       sum2=0
       for m1 in range (1,i+1):
          sum1=sum1+funcR(m1)*binomial(i+j-m1-1,i-m1)
       for m2 in range (1,j+1):
          sum2=sum2+funcL(m2)*binomial(i+j-m2-1,j-m2)
       sum=sum1+sum2
    
  • Sage
    @CachedFunction
    def T(n, k):
        if (k==0): return n^2
        elif (k==n): return 2^n
        else: return T(n-1, k-1) + T(n-1, k)
    [[T(n, k) for k in (0..n)] for n in (0..12)] # G. C. Greubel, Nov 12 2019
    

Formula

T(n,0) = n^2, n>0; T(0,k) = 2^k; T(n, k) = T(n-1, k-1) + T(n-1, k) for n,k > 0. [corrected by G. C. Greubel, Nov 12 2019]
Closed-form formula for general case. Let L(m) and R(m) be the left border and the right border of Pascal like triangle, respectively. We denote binomial(n,k) by C(n,k).
As table read by antidiagonals T(n,k) = Sum_{m1=1..n} R(m1)*C(n+k-m1-1, n-m1) + Sum_{m2=1..k} L(m2)*C(n+k-m2-1, k-m2); n,k >=0.
As linear sequence a(n) = Sum_{m1=1..i} R(m1)*C(i+j-m1-1, i-m1) + Sum_{m2=1..j} L(m2)*C(i+j-m2-1, j-m2), where i=n-t*(t+1)/2-1, j=(t*t+3*t+4)/2-n-1, t=floor((-1+sqrt(8*n-7))/2); n>0.
Some special cases. If L(m)={b,b,b...} b*A000012, then the second sum takes form b*C(n+k-1,j). If L(m) is {0,b,2b,...} b*A001477, then the second sum takes form b*C(n+k,n-1). Similarly for R(m) and the first sum.
For this sequence L(m)=m^2 and R(m)=2^m.
As table read by antidiagonals T(n,k) = Sum_{m1=1..n} (2^m1)*C(n+k-m1-1, n-m1) + Sum_{m2=1..k} (m2^2)*C(n+k-m2-1, k-m2); n,k >=0.
As linear sequence a(n) = Sum_{m1=1..i} (2^m1)*C(i+j-m1-1, i-m1) + Sum_{m2=1..j} (m2^2)*C(i+j-m2-1, j-m2), where i=n-t*(t+1)/2-1, j=(t*t+3*t+4)/2-n-1, t=floor((-1+sqrt(8*n-7))/2).
As a triangular array read by rows, T(n,k) = Sum_{i=1..n-k} i^2*C(n-1-i, n-k-i) + Sum_{i=1..k} 2^i*C(n-1-i, k-i); n,k >=0. - Greg Dresden, Aug 06 2022

Extensions

Cross-references corrected and extended by Philippe Deléham, Dec 27 2013

A220101 Number of ordered set partitions of {1,...,n} into n-1 blocks avoiding the pattern 123.

Original entry on oeis.org

0, 1, 6, 27, 112, 450, 1782, 7007, 27456, 107406, 419900, 1641486, 6418656, 25110020, 98285670, 384942375, 1508593920, 5915896470, 23213240820, 91140287370, 358042932000, 1407342229020, 5534695100220, 21777424274502, 85729014099072, 337635166767500
Offset: 1

Views

Author

Lara Pudwell, Dec 04 2012

Keywords

Comments

Let A(i, j) denote the infinite array such that the i-th row of this array is the sequence obtained by applying the partial sum operator i times to the function n^2 for n > 0. Then A(n, n) equals a(n+1) for all n > 0. - John M. Campbell, Jan 20 2019

Examples

			An ordered set partition is a set partition where the order of the blocks is important.  A 123 pattern within such a set partition is a list of 3 elements a from block i, b from block j, and c from block k such that i < j < k and a < b < c.
For n=3, the a(3)=6 ordered partitions are 12/3, 13/2, 23/1, 3/12, 2/13, 23/1.
For n=4, the a(4)=27 ordered partitions are 12/4/3, 3/12/4, 3/4/12, 4/12/3, 4/3/12, 13/4/2, 2/4/13, 4/13/2, 4/2/13, 14/3/2, 2/14/3, 3/2/14, 2/3/14, 23/1/4, 23/4/1, 1/4/23, 4/1/23, 4/23/1, 24/1/3, 24/3/1, 3/1/24, 3/24/1, 34/1/2, 34/2/1, 2/34/1, 2/1/34, 1/34/2.
		

Crossrefs

Cf. A220097 (counts 123-avoiding ordered set partitions where all blocks have size 2), A051666, A001622.

Programs

  • GAP
    List([1..30], n -> 3*(n-1)/(2*n-1)*Binomial(2*n-1,n-2)); # G. C. Greubel, Feb 12 2019
  • Haskell
    a220101 n = (a051666 (2 * (n - 1)) (n - 1)) `div` 2
    -- Reinhard Zumkeller, Aug 05 2013
    
  • Magma
    [3*(n-1)/(2*n-1)*Binomial(2*n-1,n-2): n in [1..30]]; // G. C. Greubel, Feb 12 2019
    
  • Maple
    g:=(2*x^2-7*x+2+3*x*sqrt(1-4*x)-2*sqrt(1-4*x))/(2*x*sqrt(1-4*x));
    series(g,x,50);
    seriestolist(%); # N. J. A. Sloane, Apr 13 2014
    a := n -> 3*2^(-2+2*n)*GAMMA(n-1/2)*(n-1)^2/(sqrt(Pi)*GAMMA(2+n)):
    seq(simplify(a(n)), n=1..26); # Peter Luschny, Dec 14 2015
  • Mathematica
    T[n_, 0] := n^2; T[n_, n_] := n^2;
    T[n_, k_] := T[n, k] = T[n-1, k-1] + T[n-1, k];
    a[n_] := T[2(n-1), n-1]/2;
    Array[a, 26] (* Jean-François Alcover, Jul 13 2018, after Reinhard Zumkeller *)
    Table[3*(n-1)/(2*n-1)*Binomial[2*n-1,n-2], {n,1,30}] (* G. C. Greubel, Feb 12 2019 *)
  • PARI
    vector(30, n, 3*(n-1)/(2*n-1)*binomial(2*n-1,n-2)) \\ G. C. Greubel, Feb 12 2019
    
  • Sage
    [3*(n-1)/(2*n-1)*binomial(2*n-1,n-2) for n in (1..30)] # G. C. Greubel, Feb 12 2019
    

Formula

G.f.: (2*x^2-7*x+2+3*x*sqrt(1-4*x)-2*sqrt(1-4*x))/(2*x*sqrt(1-4*x)) [see Chen et al., 2013 - Bruno Berselli, Dec 05 2012]
a(n)/a(n-1) = 2*(2*n-3)*(n-1)^2/((n+1)*(n-2)^2) for n> 2 . - Bruno Berselli, Dec 05 2012
a(n) = A051666(2*(n-1),n-1) / 2. - Reinhard Zumkeller, Aug 05 2013
a(n) = 3*(n-1)/(2*n-1)*binomial(2*n-1,n-2). [See Godbole et al., Theorem 4.] - Peter Bala, Dec 18 2013
a(n) = 3*2^(-2+2*n)*Gamma(-1/2+n)*(-1+n)^2/(sqrt(Pi)*Gamma(2+n)). - Peter Luschny, Dec 14 2015
a(n) ~ (3/4)*4^n*(1 - (21/8)/n + (393/128)/n^2 - (3055/1024)/n^3 + (99099/32768)/n^4) /sqrt(n*Pi). - Peter Luschny, Dec 16 2015
From Amiram Eldar, Feb 17 2023: (Start)
Sum_{n>=2} 1/a(n) = Pi^2/27 + 11*Pi/(27*sqrt(3)) + 1/9.
Sum_{n>=2} (-1)^n/a(n) = 4*log(phi)^2/3 + 34*log(phi)/(15*sqrt(5)) + 1/15, where phi is the golden ratio (A001622). (End)

A227550 A triangle formed like Pascal's triangle, but with factorial(n) on the borders instead of 1.

Original entry on oeis.org

1, 1, 1, 2, 2, 2, 6, 4, 4, 6, 24, 10, 8, 10, 24, 120, 34, 18, 18, 34, 120, 720, 154, 52, 36, 52, 154, 720, 5040, 874, 206, 88, 88, 206, 874, 5040, 40320, 5914, 1080, 294, 176, 294, 1080, 5914, 40320, 362880, 46234, 6994, 1374, 470, 470, 1374, 6994, 46234, 362880, 3628800
Offset: 0

Views

Author

Vincenzo Librandi, Aug 04 2013

Keywords

Comments

A003422 gives the second column (after 0).

Examples

			Triangle begins:
       1;
       1,     1;
       2,     2,    2;
       6,     4,    4,    6;
      24,    10,    8,   10,  24;
     120,    34,   18,   18,  34, 120;
     720,   154,   52,   36,  52, 154,  720;
    5040,   874,  206,   88,  88, 206,  874, 5040;
   40320,  5914, 1080,  294, 176, 294, 1080, 5914, 40320;
  362880, 46234, 6994, 1374, 470, 470, 1374, 6994, 46234, 362880;
		

Crossrefs

Cf. similar triangles with t on the borders: A007318 (t = 1), A028326 (t = 2), A051599 (t = prime(n)), A051601 (t = n), A051666 (t = n^2), A108617 (t = fibonacci(n)), A134636 (t = 2n+1), A137688 (t = 2^n), A227075 (t = 3^n).
Cf. A003422.
Cf. A227791 (central terms), A001563, A074911.

Programs

  • Haskell
    a227550 n k = a227550_tabl !! n !! k
    a227550_row n = a227550_tabl !! n
    a227550_tabl = map fst $ iterate
       (\(vs, w:ws) -> (zipWith (+) ([w] ++ vs) (vs ++ [w]), ws))
       ([1], a001563_list)
    -- Reinhard Zumkeller, Aug 05 2013
    
  • Magma
    function T(n,k)
      if k eq 0 or k eq n then return Factorial(n);
      else return T(n-1,k-1) + T(n-1,k);
      end if; return T;
    end function;
    [T(n,k): k in [0..n], n in [0..12]]; // G. C. Greubel, May 02 2021
    
  • Mathematica
    t = {}; Do[r = {}; Do[If[k == 0||k == n, m = n!, m = t[[n, k]] + t[[n, k + 1]]]; r = AppendTo[r, m], {k, 0, n}]; AppendTo[t, r], {n, 0, 10}]; t = Flatten[t]
  • Sage
    def T(n,k): return factorial(n) if (k==0 or k==n) else T(n-1, k-1) + T(n-1, k)
    flatten([[T(n,k) for k in (0..n)] for n in (0..12)]) # G. C. Greubel, May 02 2021

Formula

From G. C. Greubel, May 02 2021: (Start)
T(n, k) = T(n-1, k-1) + T(n-1, k) with T(n, 0) = T(n, n) = n!.
Sum_{k=0..n} T(n, k) = 2^n * (1 +Sum_{j=1..n-1} j*j!/2^j) = A140710(n). (End)

A222403 Triangle read by rows: left and right edges are A000217, interior entries are filled in using the Pascal triangle rule.

Original entry on oeis.org

0, 1, 1, 3, 2, 3, 6, 5, 5, 6, 10, 11, 10, 11, 10, 15, 21, 21, 21, 21, 15, 21, 36, 42, 42, 42, 36, 21, 28, 57, 78, 84, 84, 78, 57, 28, 36, 85, 135, 162, 168, 162, 135, 85, 36, 45, 121, 220, 297, 330, 330, 297, 220, 121, 45, 55, 166, 341, 517, 627, 660, 627, 517, 341, 166, 55
Offset: 0

Views

Author

N. J. A. Sloane, Feb 18 2013

Keywords

Comments

In general, if the sequence defining the left and right edges is [a_0, a_1, ...], the row sums [s_0, s_1, ...] are given by s_0=a_0 and, for n>0,
s_n = 2a_n + Sum_{i=1..n-1} 2^(n-i) a_i.
Conversely, given the rows sums [s_0, s_1, ...], the edge sequence is [a_0, a_1, ...] where a_0=s_0 and, for n>0, a_n = (s_n - Sum_{i=1..n-1} s_i)/2.

Examples

			Triangle begins:
0
1, 1
3, 2, 3
6, 5, 5, 6
10, 11, 10, 11, 10
15, 21, 21, 21, 21, 15
21, 36, 42, 42, 42, 36, 21
28, 57, 78, 84, 84, 78, 57, 28
...
		

Crossrefs

Other triangles of this type: A007318, A051666, A134634, A222404, A222405.
Cf. A000217.
Row sums are A005803.

Programs

  • Maple
    d:=[seq(n*(n+1)/2,n=0..14)];
    f:=proc(d) local T,M,n,i;
    M:=nops(d);
    T:=Array(0..M-1,0..M-1);
    for n from 0 to M-1 do T[n,0]:=d[n+1]; T[n,n]:=d[n+1]; od:
    for n from 2 to M-1 do
    for i from 1 to n-1 do T[n,i]:=T[n-1,i-1]+T[n-1,i]; od: od:
    lprint("triangle:");
    for n from 0 to M-1 do lprint(seq(T[n,i],i=0..n)); od:
    lprint("row sums:");
    lprint([seq( add(T[i,j],j=0..i), i=0..M-1)]);
    end;
    f(d);
  • Mathematica
    t[n_, n_] := n*(n+1)/2; t[n_, 0] := n*(n+1)/2; t[n_, k_] := t[n, k] = t[n-1, k-1] + t[n-1, k]; Table[t[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jan 20 2014 *)

Formula

G.f. as triangle: (1+x-4*x*y+x*y^2+x^2*y^2)*y/((1-y)^2*(-x*y+1)^2*(-x*y-y+1)). - Robert Israel, Apr 04 2018

A051667 a(n) = 6*2^n - 4*n - 6.

Original entry on oeis.org

0, 2, 10, 30, 74, 166, 354, 734, 1498, 3030, 6098, 12238, 24522, 49094, 98242, 196542, 393146, 786358, 1572786, 3145646, 6291370, 12582822, 25165730, 50331550, 100663194, 201326486, 402653074, 805306254, 1610612618, 3221225350, 6442450818, 12884901758, 25769803642
Offset: 0

Views

Author

Keywords

Crossrefs

Row sums of A051666.
Equals 2 * A050488.
Cf. A000290.

Programs

  • Magma
    I:=[0, 2, 10]; [n le 3 select I[n] else 4*Self(n-1)-5*Self(n-2)+2*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Jul 04 2012
  • Mathematica
    CoefficientList[Series[2 x (1 + x)/((1 - x)^2 (1 - 2 x)), {x, 0, 40}], x] (* Vincenzo Librandi, Jul 05 2012 *)

Formula

From Colin Barker, Jun 24 2012: (Start)
a(n) = 4*a(n-1) - 5*a(n-2) + 2*a(n-3).
G.f.: 2*x*(1 + x)/((1 - x)^2*(1 - 2*x)). (End)
E.g.f.: 2*exp(x)*(3*exp(x) - 2*x - 3). - Stefano Spezia, May 15 2023
Showing 1-5 of 5 results.