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.

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

A128175 Binomial transform of A128174.

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 4, 4, 3, 1, 8, 8, 7, 4, 1, 16, 16, 15, 11, 5, 1, 32, 32, 31, 26, 16, 6, 1, 64, 64, 63, 57, 42, 22, 7, 1, 128, 128, 127, 120, 99, 64, 29, 8, 1, 256, 256, 255, 247, 219, 163, 93, 37, 9, 1
Offset: 1

Views

Author

Gary W. Adamson, Feb 17 2007

Keywords

Comments

Row sums = A045623: (1, 2, 5, 12, 28, 64, 144, ...).
Riordan array ((1-x)/(1-2x),x/(1-x)). - Paul Barry, Oct 02 2010
Fusion of polynomial sequences p(n,x) = (x+1)^n and q(n,x) = x^n + x^(n-1) + ... + x + 1; see A193722 for the definition of fusion. - Clark Kimberling, Aug 04 2011

Examples

			First few rows of the triangle:
   1;
   1,  1;
   2,  2,  1;
   4,  4,  3,  1;
   8,  8,  7,  4,  1;
  16, 16, 15, 11,  5,  1;
  32, 32, 31, 26, 16,  6,  1;
  64, 64, 63, 57, 42, 22,  7,  1;
  ...
From _Paul Barry_, Oct 02 2010: (Start)
Production matrix is
  1, 1;
  1, 1, 1;
  0, 0, 1, 1;
  0, 0, 0, 1, 1;
  0, 0, 0, 0, 1, 1;
  0, 0, 0, 0, 0, 1, 1;
  0, 0, 0, 0, 0, 0, 1, 1;
  0, 0, 0, 0, 0, 0, 0, 1, 1;
  0, 0, 0, 0, 0, 0, 0, 0, 1, 1;
  ...
Matrix logarithm is
  0;
  1, 0;
  1, 2, 0;
  1, 1, 3, 0;
  1, 1, 1, 4, 0;
  1, 1, 1, 1, 5, 0;
  1, 1, 1, 1, 1, 6, 0;
  1, 1, 1, 1, 1, 1, 7, 0;
  1, 1, 1, 1, 1, 1, 1, 8, 0;
  1, 1, 1, 1, 1, 1, 1, 1, 9,  0;
  1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 0;
  ... (End)
.
First few rows of the array:
  1, 1,  2,  4,  8,  16, ...
  1, 2,  4,  8, 16,  32, ...
  1, 3,  7, 15, 31,  63, ...
  1, 4, 11, 26, 57, 120, ...
  1, 5, 16, 42, 99, 219, ...
  ...
		

Crossrefs

Programs

  • Maple
    A193820 := (n,k) -> `if`(k=0 or n=0, 1, A193820(n-1,k-1)+A193820(n-1,k));
    A128175 := (n,k) -> A193820(n-1,n-k);
    seq(print(seq(A128175(n,k),k=0..n)),n=0..10); # Peter Luschny, Jan 22 2012
  • Mathematica
    z = 10; a = 1; b = 1;
    p[n_, x_] := (a*x + b)^n
    q[0, x_] := 1
    q[n_, x_] := x*q[n - 1, x] + 1; q[n_, 0] := q[n, x] /. x -> 0;
    t[n_, k_] := Coefficient[p[n, x], x^k]; t[n_, 0] := p[n, x] /. x -> 0;
    w[n_, x_] := Sum[t[n, k]*q[n + 1 - k, x], {k, 0, n}]; w[-1, x_] := 1
    g[n_] := CoefficientList[w[n, x], {x}]
    TableForm[Table[Reverse[g[n]], {n, -1, z}]]
    Flatten[Table[Reverse[g[n]], {n, -1, z}]]   (* A193820 *)
    TableForm[Table[g[n], {n, -1, z}]]
    Flatten[Table[g[n], {n, -1, z}]]  (* A128175 *)
    (* Clark Kimberling, Aug 06 2011 *)
    (* function dotTriangle[] is defined in A128176 *)
    a128175[r_] := dotTriangle[Binomial, If[EvenQ[#1 + #2], 1, 0]&, r]
    TableForm[a128174[7]] (* triangle *)
    Flatten[a128174[9]] (* data *) (* Hartmut F. W. Hoft, Mar 15 2017 *)

Formula

A007318 * A128174 as infinite lower triangular matrices.
Antidiagonals of an array in which the first row = (1, 1, 2, 4, 8, 16, ...); and (n+1)-th row = partial sums of n-th row.
exp(x) * e.g.f. for row n = e.g.f. for diagonal n. For example, for n = 3 we have exp(x)*(4 + 4*x + 3*x^2/2! + x^3/3!) = 4 + 8*x + 15*x^2/2! + 26*x^3/3! + 42*x^4/4! + .... The same property holds more generally for Riordan arrays of the form ( f(x), x/(1 - x) ). - Peter Bala, Dec 22 2014
T(n, k) = Sum_{i=0..floor((n-k)/2)} binomial(n-1, k-1+2*i). - Werner Schulte, Mar 05 2025
T(n, k) = binomial(n-1, k-1)*hypergeom([1, (k-n)/2, (1+k-n)/2], [(1+k)/2, k/2], 1). - Stefano Spezia, Mar 07 2025

A117670 Triangle read by rows: partial sums of the Pascal triangle minus 1.

Original entry on oeis.org

1, 2, 3, 3, 6, 7, 4, 10, 14, 15, 5, 15, 25, 30, 31, 6, 21, 41, 56, 62, 63, 7, 28, 63, 98, 119, 126, 127, 8, 36, 92, 162, 218, 246, 254, 255, 9, 45, 129, 255, 381, 465, 501, 510, 511, 10, 55, 175, 385, 637, 847, 967, 1012, 1022, 1023
Offset: 1

Views

Author

Arie Bos, Jul 06 2008, Jul 08 2008

Keywords

Comments

Imagine that you are in a building with floors starting at floor 1, the lowest floor and you have a large number of eggs. For each floor in the building, you want to know whether or not an egg dropped from that floor will break.
If an egg breaks when dropped from floor i, then all eggs are guaranteed to break when dropped from any floor j > i. Likewise, if an egg doesn't break when dropped from floor i, then all eggs are guaranteed to never break when dropped from any floor j <= i.
a(n,k) is the maximum number of floors where you can determine whether or not an egg will break when dropped from any floor, with the following restrictions: you may drop a maximum of n eggs (one at a time, from any floors of your choosing) and you may break a maximum of k eggs.
Each row of the triangle is the running sum of the corresponding row with the first 1 omitted of Pascal's triangle (A007318), see A008949, A054143, A193820.
The k-th entry in the n-th row is the number of possible combinations of on/off switches after k attempts to turn on a switch in a set of n distinguishable switches. An attempt to turn on the same switch twice does not result in a new combination. See example. - Sergei Viznyuk, Jun 24 2012
T(n,k) is the number of nonempty subsets of the n-set with at most k elements, see example. - Joerg Arndt, May 04 2014

Examples

			Triangle a(n,k) begins:
n\k  1   2    3    4    5    6    7     8     9    10 ...
1:   1
2:   2   3
3:   3   6    7
4:   4  10   14   15
5:   5  15   25   30   31
6:   6  21   41   56   62   63
7:   7  28   63   98  119  126  127
8:   8  36   92  162  218  246  254   255
9:   9  45  129  255  381  465  501   510   511
10: 10  55  175  385  637  847  967  1012  1022  1023
...  Reformatted and extended by _Wolfdieter Lang_, Feb 07 2013
From _Sergei Viznyuk_, Jun 24 2012: (Start)
For example, we have n=3 distinguishable switches A,B,C (third row above). We attempt k=2 times to turn on a switch at random. The possible resulting combinations are:
A=on, B=off, C=off (the same A switch was turned on 2 times)
A=off, B=on, C=off (the same B switch was turned on 2 times)
A=off, B=off, C=on (the same C switch was turned on 2 times)
A=on, B=on, C=off  (switches A and B were turned on)
A=on, B=off, C=on  (switches A and C were turned on)
A=off, B=on, C=on  (switches B and C were turned on)
Thus, we have 6 different combinations, which is the number 6 at row n=3 column k=2 in the sequence above.
(End)
From _Joerg Arndt_, May 04 2014: (Start)
There are T(4,2) = 10 subsets of {0, 1, 2, 3}:
01:    1...    { 0 }
02:    11..    { 0, 1 }
03:    111.    { 0, 1, 2 }
04:    11.1    { 0, 1, 3 }
05:    1.1.    { 0, 2 }
06:    1.11    { 0, 2, 3 }
07:    1..1    { 0, 3 }
08:    .1..    { 1 }
09:    .11.    { 1, 2 }
10:    .111    { 1, 2, 3 }
11:    .1.1    { 1, 3 }
12:    ..1.    { 2 }
13:    ..11    { 2, 3 }
14:    ...1    { 3 }
(End)
		

Programs

  • Mathematica
    Table[Sum[Binomial[n, m], {m, k}], {n, 10}, {k, n}] // Flatten (* Michael De Vlieger, Nov 25 2015 *)
  • PARI
    tabl(nrows) = {for (n=1, nrows, for (k=1, n, print1(sum(m=1,k,binomial(n,m)), ", ");); print(););} \\ Michel Marcus, May 21 2013

Formula

a(n,1) = n ; a(n,n) = 2^n-1; a(n+1,k+1) = 1 + a(n,k) + a(n,k-1), 0 < k < n.
a(n,k) = sum(binomial(n,m),m=1..k), 1 <= k <= n. (see the running sum comment above). - Wolfdieter Lang, Feb 07 2013
Showing 1-3 of 3 results.