Logo

MonoCalc

/

Pascal's Triangle Generator

Math

Try an Example

Display Mode

1
1
1
1
2
1
1
3
3
1
1
4
6
4
1
1
5
10
10
5
1
1
6
15
20
15
6
1
1
7
21
35
35
21
7
1
1
8
28
56
70
56
28
8
1
1
9
36
84
126
126
84
36
9
1

About This Tool

Pascal's Triangle Generator – Build Rows and Look Up C(n,k)

Pascal's triangle is a triangular array of binomial coefficients. Row n lists the values C(n,0) through C(n,n), where C(n,k) = n! / (k!(n−k)!) counts the number of ways to choose k items from a set of n. Every interior entry equals the sum of the two entries directly above it — the same additive rule this generator uses to build the full triangle, edge to edge, using exact BigInt arithmetic so there is no floating-point rounding even at high row counts.

Two Ways to Compute

Building the whole triangle is efficient with the additive rule C(n,k) = C(n−1,k−1) + C(n−1,k), since every entry is a single addition once the row above is known. But if you only need one value — say C(20,6) — there's no need to build 20 rows first. The multiplicative formula C(n,k) = (n·(n−1)·...·(n−k+1)) / k! computes a single entry directly, and this tool automatically uses the symmetry C(n,k) = C(n,n−k) to multiply through whichever of k or n−k is smaller.

Row Sums and Powers of Two

Every row of Pascal's triangle sums to a power of two: Σ C(n,k) = 2ⁿ. This makes sense combinatorially — the entries in row n count every way to choose a subset of any size from n items, and there are exactly 2ⁿ subsets total. The Row Sum highlight mode computes both sides and confirms the identity for the row you choose.

The Sierpiński Triangle Hidden in the Parity

Coloring each entry by whether C(n,k) is odd or even reveals the Sierpiński triangle fractal once enough rows are drawn. This isn't a coincidence — by Kummer's theorem (equivalently, a bitwise reading of Lucas' theorem), C(n,k) is odd exactly when every binary digit of k is less than or equal to the corresponding digit of n, i.e. when (n & k) === k in binary. The parity highlight computes this bitwise test cell by cell instead of the full value, so it stays fast even at large row counts.

Diagonals and the Fibonacci Sequence

The "shallow" diagonals that run up and to the right through the triangle — where the row and column indices add to a constant n + k = m — sum to the Fibonacci numbers. Summing along the diagonal for m = 0, 1, 2, ... gives 1, 1, 2, 3, 5, 8, ..., matching F(m+1) in the standard Fibonacci sequence. The diagonal highlight lists each term in the sum and checks it against the Fibonacci number it should equal.

The Hockey Stick Identity

Running a finger down one diagonal of the triangle and then bending sideways into the next row traces a hockey-stick shape — hence the name. Algebraically, Σ (i = r to n) C(i,r) = C(n+1, r+1): summing a run of entries along a diagonal equals the single entry just below and to the right of where the run ends. The hockey stick mode highlights the run and the target cell together and verifies both sides are equal.

Reading Very Large Entries

Central entries grow quickly — row 60 already exceeds Number.MAX_SAFE_INTEGER. Because every computation uses BigInt internally, the exact value is always preserved; the scientific-notation display option simply controls whether large numbers are shown compactly (e.g. 1.379e+58) or in full, comma-separated form.

When to use this tool
Use the Pascal's Triangle Generator for combinatorics and probability homework, verifying a binomial expansion coefficient, or exploring the number-theoretic patterns hidden in the triangle. For expanding a full binomial expression like (x + y)⁵, pair it with the Binomial Expansion Calculator.

Frequently Asked Questions

Is the Pascal's Triangle Generator free?

Yes, Pascal's Triangle Generator is totally free :)

Can I use the Pascal's Triangle Generator offline?

Yes, you can install the webapp as PWA.

Is it safe to use Pascal's Triangle Generator?

Yes, any data related to Pascal's Triangle Generator only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

How does the Pascal's Triangle Generator work?

It builds each row using the additive rule C(n,k) = C(n-1,k-1) + C(n-1,k), with every row edge equal to 1. All arithmetic uses native BigInt, so entries stay exact integers even for large row counts. A single entry C(n,k) can also be looked up directly with the multiplicative formula, without generating the whole triangle.

What is the formula for a single entry C(n, k)?

C(n,k) = n! / (k! × (n−k)!). The tool computes this efficiently with C(n,k) = (n · (n−1) · ... · (n−k+1)) / k!, using the symmetry C(n,k) = C(n,n−k) to always multiply through the smaller of k and n−k.

Why do the entries in row n always sum to 2^n?

Row n lists every way to choose 0, 1, 2, ... up to n items from a set of n — together these cover all 2^n possible subsets, so the binomial coefficients in that row must add up to 2^n. The Row Sum highlight verifies this for any row you generate.

What is the Sierpiński triangle pattern shown by the parity highlight?

Shading each entry by whether it is odd or even (C(n,k) mod 2) reveals the Sierpiński triangle fractal for larger row counts. This follows from Kummer's/Lucas' theorem: C(n,k) is odd exactly when every binary digit of k is less than or equal to the corresponding digit of n.

How large can the row count and lookup values be?

Full-triangle generation supports up to 200 rows to keep the grid renderable. Single-entry and single-row lookups support n up to 1,000 without rendering the whole triangle. Every value is computed exactly with BigInt, though very large entries are shown in scientific notation when that display option is enabled.

What is the hockey stick identity demonstrated here?

It states that Σ (from i = r to n) C(i, r) equals C(n+1, r+1) — summing a diagonal run of entries and adding one more step gives the entry just below and to the right, forming a hockey-stick shape on the triangle. The tool computes both sides with BigInt and confirms they match exactly.