A047999 Sierpiński's [Sierpinski's] triangle (or gasket): triangle, read by rows, formed by reading Pascal's triangle (A007318) mod 2.
1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1
Offset: 0
Examples
Triangle begins: 1, 1,1, 1,0,1, 1,1,1,1, 1,0,0,0,1, 1,1,0,0,1,1, 1,0,1,0,1,0,1, 1,1,1,1,1,1,1,1, 1,0,0,0,0,0,0,0,1, 1,1,0,0,0,0,0,0,1,1, 1,0,1,0,0,0,0,0,1,0,1, 1,1,1,1,0,0,0,0,1,1,1,1, 1,0,0,0,1,0,0,0,1,0,0,0,1, ...
References
- Boris A. Bondarenko, Generalized Pascal Triangles and Pyramids (in Russian), FAN, Tashkent, 1990, ISBN 5-648-00738-8.
- Brand, Neal; Das, Sajal; Jacob, Tom. The number of nonzero entries in recursively defined tables modulo primes. Proceedings of the Twenty-first Southeastern Conference on Combinatorics, Graph Theory, and Computing (Boca Raton, FL, 1990). Congr. Numer. 78 (1990), 47--59. MR1140469 (92h:05004).
- John W. Milnor and James D. Stasheff, Characteristic Classes, Princeton University Press, 1974, pp. 43-49 (sequence appears on p. 46).
- H.-O. Peitgen, H. Juergens and D. Saupe: Chaos and Fractals (Springer-Verlag 1992), p. 408.
- Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
- S. Wolfram, A New Kind of Science, Wolfram Media, 2002; Chapter 3.
Links
- N. J. A. Sloane, Table of n, a(n) for n = 0..10584 [First 144 rows, flattened; first 50 rows from T. D. Noe].
- J.-P. Allouche and V. Berthe, Triangle de Pascal, complexité et automates, Bulletin of the Belgian Mathematical Society Simon Stevin 4.1 (1997): 1-24.
- J.-P. Allouche, F. v. Haeseler, H.-O. Peitgen and G. Skordev, Linear cellular automata, finite automata and Pascal's triangle, Discrete Appl. Math. 66 (1996), 1-22.
- David Applegate, Omar E. Pol and N. J. A. Sloane, The Toothpick Sequence and Other Sequences from Cellular Automata, Congressus Numerantium, Vol. 206 (2010), 157-191. [There is a typo in Theorem 6: (13) should read u(n) = 4.3^(wt(n-1)-1) for n >= 2.],
- J. Baer, Explore patterns in Pascal's Triangle
- Valentin Bakoev, Fast Bitwise Implementation of the Algebraic Normal Form Transform, Serdica J. of Computing 11 (2017), No 1, 45-57.
- Valentin Bakoev, Properties and links concerning M_n
- Thomas Baruchel, Flattening Karatsuba's Recursion Tree into a Single Summation, SN Computer Science (2020) Vol. 1, Article No. 48.
- Thomas Baruchel, A non-symmetric divide-and-conquer recursive formula for the convolution of polynomials and power series, arXiv:1912.00452 [math.NT], 2019.
- A. Bogomolny, Dot Patterns and Sierpinski Gasket
- Boris A. Bondarenko, Generalized Pascal Triangles and Pyramids, English translation published by Fibonacci Association, Santa Clara Univ., Santa Clara, CA, 1993; see pp. 130-132.
- Paul Bradley and Peter Rowley, Orbits on k-subsets of 2-transitive Simple Lie-type Groups, 2014.
- E. Burlachenko, Fractal generalized Pascal matrices, arXiv:1612.00970 [math.NT], 2016. See p. 9.
- S. Butkevich, Pascal Triangle Applet
- David Callan, Sierpinski's triangle and the Prouhet-Thue-Morse word, arXiv:math/0610932 [math.CO], 2006.
- B. Cherowitzo, Pascal's Triangle using Clock Arithmetic, Part I
- B. Cherowitzo, Pascal's Triangle using Clock Arithmetic, Part II
- C. Cobeli, A. Zaharescu, A game with divisors and absolute differences of exponents, arXiv:1411.1334 [math.NT], 2014; Journal of Difference Equations and Applications, Vol. 20, #11, 2014.
- Ilya Gutkovskiy, Illustrations (triangle formed by reading Pascal's triangle mod m)
- R. K. Guy, The strong law of small numbers. Amer. Math. Monthly 95 (1988), no. 8, 697-712.
- Brady Haran, Chaos Game, Numberphile video, YouTube (April 27, 2017).
- I. Kobayashi et al., Pascal's Triangle
- Dr. Math, Regular polygon formulas [Broken link?]
- Y. Moshe, The distribution of elements in automatic double sequences, Discr. Math., 297 (2005), 91-103.
- National Curve Bank, Sierpinski Triangles
- Hieu D. Nguyen, A Digital Binomial Theorem, arXiv:1412.3181 [math.NT], 2014.
- S. Northshield, Sums across Pascal's triangle modulo 2, Congressus Numerantium, 200, pp. 35-52, 2010.
- A. M. Reiter, Determining the dimension of fractals generated by Pascal's triangle, Fibonacci Quarterly, 31(2), 1993, pp. 112-120.
- F. Richman, Javascript for computing Pascal's triangle modulo n. Go to this page, then under "Modern Algebra and Other Things", click "Pascal's triangle modulo n".
- Vladimir Shevelev, On Stephan's conjectures concerning Pascal triangle modulo 2 and their polynomial generalization, J. of Algebra Number Theory: Advances and Appl., 7 (2012), no.1, 11-29. Also arXiv:1011.6083, 2010.
- N. J. A. Sloane, Illustration of rows 0 to 32 (encoignure style)
- N. J. A. Sloane, Illustration of rows 0 to 64 (encoignure style)
- N. J. A. Sloane, Illustration of rows 0 to 128 (encoignure style)
- N. J. A. Sloane, Catalog of Toothpick and Cellular Automata Sequences in the OEIS
- Eric Weisstein's World of Mathematics, Sierpiński Sieve, Rule 60, Rule 102
- Index entries for sequences related to cellular automata
- Index entries for triangles and arrays related to Pascal's triangle
- Index entries for sequences generated by sieves
Crossrefs
Sequences based on the triangles formed by reading Pascal's triangle mod m: (this sequence) (m = 2), A083093 (m = 3), A034931 (m = 4), A095140 (m = 5), A095141 (m = 6), A095142 (m = 7), A034930(m = 8), A095143 (m = 9), A008975 (m = 10), A095144 (m = 11), A095145 (m = 12), A275198 (m = 14), A034932 (m = 16).
Cf. A007318, A054431, A001317, A008292, A083093, A034931, A034930, A008975, A034932, A166360, A249133, A064194, A227133.
From Johannes W. Meijer, Jun 05 2011: (Start)
A106344 is a skew version of this triangle.
Programs
-
Haskell
import Data.Bits (xor) a047999 :: Int -> Int -> Int a047999 n k = a047999_tabl !! n !! k a047999_row n = a047999_tabl !! n a047999_tabl = iterate (\row -> zipWith xor ([0] ++ row) (row ++ [0])) [1] -- Reinhard Zumkeller, Dec 11 2011, Oct 24 2010
-
Magma
A047999:= func< n,k | BitwiseAnd(n-k, k) eq 0 select 1 else 0 >; [A047999(n,k): k in [0..n], n in [0..15]]; // G. C. Greubel, Dec 03 2024
-
Maple
# Maple code for first M rows (here M=10) - N. J. A. Sloane, Feb 03 2016 ST:=[1,1,1]; a:=1; b:=2; M:=10; for n from 2 to M do ST:=[op(ST),1]; for i from a to b-1 do ST:=[op(ST), (ST[i+1]+ST[i+2]) mod 2 ]; od: ST:=[op(ST),1]; a:=a+n; b:=a+n; od: ST; # N. J. A. Sloane # alternative A047999 := proc(n,k) modp(binomial(n,k),2) ; end proc: seq(seq(A047999(n,k),k=0..n),n=0..12) ; # R. J. Mathar, May 06 2016
-
Mathematica
Mod[ Flatten[ NestList[ Prepend[ #, 0] + Append[ #, 0] &, {1}, 13]], 2] (* Robert G. Wilson v, May 26 2004 *) rows = 14; ca = CellularAutomaton[60, {{1}, 0}, rows-1]; Flatten[ Table[ca[[k, 1 ;; k]], {k, 1, rows}]] (* Jean-François Alcover, May 24 2012 *) Mod[#,2]&/@Flatten[Table[Binomial[n,k],{n,0,20},{k,0,n}]] (* Harvey P. Dale, Jun 26 2019 *) A047999[n_,k_]:= Boole[BitAnd[n-k,k]==0]; Table[A047999[n,k], {n,0,15}, {k,0,n}]//Flatten (* G. C. Greubel, Sep 03 2025 *)
-
PARI
\\ Recurrence for Pascal's triangle mod p, here p = 2. p = 2; s=13; T=matrix(s,s); T[1,1]=1; for(n=2,s, T[n,1]=1; for(k=2,n, T[n,k] = (T[n-1,k-1] + T[n-1,k])%p )); for(n=1,s,for(k=1,n,print1(T[n,k],", "))) \\ Gerald McGarvey, Oct 10 2009
-
PARI
A011371(n)=my(s);while(n>>=1,s+=n);s T(n,k)=A011371(n)==A011371(k)+A011371(n-k) \\ Charles R Greathouse IV, Aug 09 2013
-
PARI
T(n,k)=bitand(n-k,k)==0 \\ Charles R Greathouse IV, Aug 11 2016
-
Python
def A047999_T(n,k): return int(not ~n & k) # Chai Wah Wu, Feb 09 2016
Formula
Lucas's Theorem is that T(n,k) = 1 if and only if the 1's in the binary expansion of k are a subset of the 1's in the binary expansion of n; or equivalently, k AND NOT n is zero, where AND and NOT are bitwise operators. - Chai Wah Wu, Feb 09 2016 and N. J. A. Sloane, Feb 10 2016
T(n,k) = T(n-1,k-1) XOR T(n-1,k), 0 < k < n; T(n,0) = T(n,n) = 1. - Reinhard Zumkeller, Dec 13 2009
T(n,k) = (T(n-1,k-1) + T(n-1,k)) mod 2 = |T(n-1,k-1) - T(n-1,k)|, 0 < k < n; T(n,0) = T(n,n) = 1. - Rick L. Shepherd, Feb 23 2018
From Vladimir Shevelev, Dec 31 2013: (Start)
For polynomial {s_n(x)} we have
s_0(x)=1; for n>=1, s_n(x) = Product_{i=1..A000120(n)} (x^(2^k_i) + 1),
if the binary expansion of n is n = Sum_{i=1..A000120(n)} 2^k_i;
G.f. Sum_{n>=0} s_n(x)*z^n = Product_{k>=0} (1 + (x^(2^k)+1)*z^(2^k)) (0
Let x>1, t>0 be real numbers. Then
Sum_{n>=0} 1/s_n(x)^t = Product_{k>=0} (1 + 1/(x^(2^k)+1)^t);
Sum_{n>=0} (-1)^A000120(n)/s_n(x)^t = Product_{k>=0} (1 - 1/(x^(2^k)+1)^t).
In particular, for t=1, x>1, we have
Sum_{n>=0} (-1)^A000120(n)/s_n(x) = 1 - 1/x. (End)
From Valentin Bakoev, Jul 11 2020: (Start)
(See my comment about the matrix M_n.) Denote by T(i,j) the number in the i-th row and j-th column of M_n (0 <= i, j < 2^n). When i>=j, T(i,j) is the j-th number in the i-th row of the Sierpinski's triangle. For given i and j, we denote by k the largest integer of the type k=2^m and k
T(i,0) = T(i,i) = 1, or
T(i,j) = 0 if i < j, or
T(i,j) = T(i-k,j), if j < k, or
T(i,j) = T(i-k,j-k), if j >= k.
Thus, for given i and j, T(i,j) can be computed in O(log_2(i)) steps. (End)
Extensions
Additional links from Lekraj Beedassy, Jan 22 2004
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.
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
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;
Links
- Boris Putievskiy, Rows n = 1..140 of triangle, flattened
- Rely Pellicer and David Alvo, Modified Pascal Triangle and Pascal Surfaces p.4
- Index entries for triangles and arrays related to Pascal's triangle
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).
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
A051601 Rows of triangle formed using Pascal's rule except we begin and end the n-th row with n.
0, 1, 1, 2, 2, 2, 3, 4, 4, 3, 4, 7, 8, 7, 4, 5, 11, 15, 15, 11, 5, 6, 16, 26, 30, 26, 16, 6, 7, 22, 42, 56, 56, 42, 22, 7, 8, 29, 64, 98, 112, 98, 64, 29, 8, 9, 37, 93, 162, 210, 210, 162, 93, 37, 9, 10, 46, 130, 255, 372, 420, 372, 255, 130, 46, 10
Offset: 0
Comments
The number of spotlight tilings of an m X n rectangle missing the southeast corner. E.g., there are 2 spotlight tilings of a 2 X 2 square missing its southeast corner. - Bridget Tenner, Nov 10 2007
For a closed-form formula for arbitrary left and right borders of Pascal like triangle see A228196. - Boris Putievskiy, Aug 18 2013
For a closed-form formula for generalized Pascal's triangle see A228576. - Boris Putievskiy, Sep 09 2013
Examples
From _Roger L. Bagula_, Feb 17 2009: (Start) Triangle begins: 0; 1, 1; 2, 2, 2; 3, 4, 4, 3; 4, 7, 8, 7, 4; 5, 11, 15, 15, 11, 5; 6, 16, 26, 30, 26, 16, 6; 7, 22, 42, 56, 56, 42, 22, 7; 8, 29, 64, 98, 112, 98, 64, 29, 8; 9, 37, 93, 162, 210, 210, 162, 93, 37, 9; 10, 46, 130, 255, 372, 420, 372, 255, 130, 46, 10; 11, 56, 176, 385, 627, 792, 792, 627, 385, 176, 56, 11; 12, 67, 232, 561, 1012, 1419, 1584, 1419, 1012, 561, 232, 67, 12. ... (End)
Links
- Reinhard Zumkeller, Rows n = 0..120 of triangle, flattened
- B. E. Tenner, Spotlight tiling, Ann. Combinat. 14 (4) (2010) 553-568.
- Index entries for triangles and arrays related to Pascal's triangle
Crossrefs
Programs
-
GAP
Flat(List([0..12], n-> List([0..n], k-> Binomial(n, k+1) + Binomial(n, n-k+1) ))); # G. C. Greubel, Nov 12 2019
-
Haskell
a051601 n k = a051601_tabl !! n !! k a051601_row n = a051601_tabl !! n a051601_tabl = iterate (\row -> zipWith (+) ([1] ++ row) (row ++ [1])) [0] -- Reinhard Zumkeller, Nov 23 2012
-
Magma
/* As triangle: */ [[Binomial(n,m+1)+Binomial(n,n-m+1): m in [0..n]]: n in [0..12]]; // Bruno Berselli, Aug 02 2013
-
Maple
seq(seq(binomial(n,k+1) + binomial(n, n-k+1), k=0..n), n=0..12); # G. C. Greubel, Nov 12 2019
-
Mathematica
T[n_, k_]:= T[n, k] = Binomial[n, k+1] + Binomial[n, n-k+1]; Table[T[n, k], {n,0,12}, {k,0,n}]//Flatten (* Roger L. Bagula, Feb 17 2009; modified by G. C. Greubel, Nov 12 2019 *)
-
PARI
T(n,k) = binomial(n, k+1) + binomial(n, n-k+1); for(n=0,12, for(k=0,n, print1(T(n,k), ", "))) \\ G. C. Greubel, Nov 12 2019
-
Sage
[[binomial(n, k+1) + binomial(n, n-k+1) for k in (0..n)] for n in (0..12)] # G. C. Greubel, Nov 12 2019
Formula
T(m,n) = binomial(m+n,m) - 2*binomial(m+n-2,m-1), up to offset and transformation of array to triangular indices. - Bridget Tenner, Nov 10 2007
T(n,k) = binomial(n, k+1) + binomial(n, n-k+1). - Roger L. Bagula, Feb 17 2009
T(0,n) = T(n,0) = n, T(n,k) = T(n-1,k) + T(n-1,k-1), 0 < k < n.
A051597 Rows of triangle formed using Pascal's rule except begin and end n-th row with n+1.
1, 2, 2, 3, 4, 3, 4, 7, 7, 4, 5, 11, 14, 11, 5, 6, 16, 25, 25, 16, 6, 7, 22, 41, 50, 41, 22, 7, 8, 29, 63, 91, 91, 63, 29, 8, 9, 37, 92, 154, 182, 154, 92, 37, 9, 10, 46, 129, 246, 336, 336, 246, 129, 46, 10, 11, 56, 175, 375, 582, 672, 582, 375, 175, 56, 11
Offset: 0
Comments
Row sums give A033484(n).
The number of spotlight tilings of an (m+1) X (n+1) rectangle, read by antidiagonals. - Bridget Tenner, Nov 09 2007
T(n,k) = A209561(n+2,k+1), 0 <= k <= n. - Reinhard Zumkeller, Dec 26 2012
For a closed-form formula for arbitrary left and right borders of Pascal like triangle see A228196. - Boris Putievskiy, Aug 19 2013
For a closed-form formula for generalized Pascal's triangle see A228576. - Boris Putievskiy, Sep 09 2013
Examples
Triangle begins as: 1; 2, 2; 3, 4, 3; 4, 7, 7, 4; 5, 11, 14, 11, 5;
Links
- Reinhard Zumkeller, Rows n = 0..120 of triangle, flattened
- B. E. Tenner, Spotlight tiling, Ann. Combin. 14 (4) (2010) 553.
- Index entries for triangles and arrays related to Pascal's triangle
Programs
-
GAP
T:= function(n,k) if k<0 or k>n then return 0; elif k=0 or k=n then return n+1; 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 18 2019
-
Haskell
a051597 n k = a051597_tabl !! n !! k a051597_row n = a051597_tabl !! n a051597_tabl = iterate (\row -> zipWith (+) ([1] ++ row) (row ++ [1])) [1] -- Reinhard Zumkeller, Nov 23 2012
-
Magma
function T(n,k) if k lt 0 or k gt n then return 0; elif k eq 0 or k eq n then return n+1; 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, Nov 18 2019
-
Maple
T:= proc(n, k) option remember; `if`(k<0 or k>n, 0, `if`(k=0 or k=n, n+1, T(n-1, k-1) + T(n-1, k) )) end: seq(seq(T(n, k), k=0..n), n=0..14); # Alois P. Heinz, May 27 2013
-
Mathematica
NestList[Append[ Prepend[Map[Apply[Plus, #] &, Partition[#, 2, 1]], #[[1]] + 1], #[[1]] + 1] &, {1}, 10] // Grid (* Geoffrey Critzer, May 26 2013 *) T[n_, k_] := T[n, k] = If[k<0 || k>n, 0, If[k==0 || k==n, n+1, T[n-1, k-1] + T[n-1, k]]]; Table[T[n, k], {n, 0, 14}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jan 09 2016, after Alois P. Heinz *)
-
PARI
T(n,k) = if(k<0 || k>n, 0, if(k==0 || k==n, n+1, T(n-1, k-1) + T(n-1, k) )); for(n=0, 12, for(k=0, n, print1(T(n,k), ", "))) \\ G. C. Greubel, Nov 18 2019
-
Sage
@CachedFunction def T(n, k): if (k<0 or k>n): return 0 elif (k==0 or k==n): return n+1 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 18 2019
Formula
T(2n,n) = A051924(n+1). - Philippe Deléham, Nov 26 2006
T(m,n) = binomial(m+n,m) - binomial(m+n-2,m-1) (correct up to offset and transformation of square indices to triangular indices). - Bridget Tenner, Nov 09 2007
T(0,n) = T(n,0) = n+1, T(n,k) = T(n-1,k) + T(n-1,k-1), 0 < k < n.
From Peter Bala, Feb 28 2013: (Start)
T(n,k) = binomial(n,k-1) + binomial(n,k) + binomial(n,k+1) for 0 <= k <= n.
O.g.f.: (1 - xt^2)/((1 - t)(1 - xt)(1 - (1+x)t)) = 1 + (2 + 2x)t + (3 + 4x + 3x^2)t^2 + ....
Row polynomials: ((1+x+x^2)*(1+x)^n - 1 - x^(n+2))/x. (End)
A048487 a(n) = T(4,n), array T given by A048483.
1, 6, 16, 36, 76, 156, 316, 636, 1276, 2556, 5116, 10236, 20476, 40956, 81916, 163836, 327676, 655356, 1310716, 2621436, 5242876, 10485756, 20971516, 41943036, 83886076, 167772156, 335544316, 671088636, 1342177276, 2684354556, 5368709116, 10737418236, 21474836476
Offset: 0
Comments
Row sums of triangle A131113. - Gary W. Adamson, Jun 15 2007
a(n) = sum of (n+1)-th row terms of triangle A134636. This sequence is the binomial transform of 1, 5, 5, (5 continued). - Gary W. Adamson, Nov 04 2007
Row sums of triangle A135856. - Gary W. Adamson, Dec 01 2007
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (3,-2).
Crossrefs
Programs
-
Magma
[5*2^n-4: n in [0..30]]; // Vincenzo Librandi, Sep 23 2011
-
Mathematica
a=1; lst={a}; k=5; Do[a+=k; AppendTo[lst, a]; k+=k, {n, 0, 5!}]; lst (* Vladimir Joseph Stephan Orlovsky, Dec 15 2008 *) a=6; lst={1, a}; k=10; Do[a+=k; AppendTo[lst, a]; k+=k, {n, 0, 5!}]; lst (* Vladimir Joseph Stephan Orlovsky, Dec 17 2008 *)
Formula
a(n) = 5*2^n - 4. - Henry Bottomley, May 29 2001
a(n) = 2*a(n-1) + 4 for n > 0 with a(0) = 1. - Paul Barry, Aug 25 2004
From Colin Barker, Sep 13 2012: (Start)
a(n) = 3*a(n-1) - 2*a(n-2) for n >= 2.
G.f.: (1 + 3*x)/((1 - x)*(1 - 2*x)). (End)
a(n) = A123208(2*n). - Philippe Deléham, Apr 15 2013
E.g.f.: exp(x)*(5*exp(x) - 4). - Stefano Spezia, Oct 03 2023
A227550 A triangle formed like Pascal's triangle, but with factorial(n) on the borders instead of 1.
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
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;
Links
- Vincenzo Librandi, Rows n = 0..70, flattened
Crossrefs
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)
Comments