Linha do Triângulo de Pascal
Gera a n-ésima linha (n=0,1,...) do triângulo de Pascal.
Linha
—
Pascal's triangle: a row of binomial coefficients
Row n of Pascal's triangle is just the binomial coefficients C(n, k) = n! / (k!(n − k)!) written out for k = 0, 1, …, n. Every entry is the sum of the two sitting above it, and add up a whole row and you land on 2ⁿ. The patterns hiding inside are what make it fun. There's the symmetry C(n, k) = C(n, n − k), the diagonals that carry triangular and tetrahedral numbers, and Fibonacci numbers waiting along the shallow diagonals. Read the entries modulo 2 and the Sierpinski fractal appears. Blaise Pascal pulled all of this together in his Traité du Triangle Arithmétique (1654), but the structure already shows up earlier in Chinese, Indian and Persian sources. Take n = 4 as an example: the row reads 1, 4, 6, 4, 1, and sure enough 1 + 4 + 6 + 4 + 1 = 16 = 2⁴.
Applications: combinatorics, probability and algebra
Those same rows feed the binomial theorem (a + b)ⁿ = Σ C(n, k)·a^(n−k)·b^k. They handle combinatorial counting, telling you how many subsets of size k you can pull from n items. They give you binomial probability, the number of ways to land k heads across n tosses. And they turn up in high-school algebra, in the ENEM-style binomial expansions students grind through.
FAQ
Where does row 0 start? Right at the top. Row 0 holds a single entry, 1 = C(0, 0), and from there row n always has n + 1 entries.
Why does each row sum to 2ⁿ? Set both terms to 1 in the binomial theorem and the answer falls out: (1 + 1)ⁿ = Σ C(n, k) = 2ⁿ.
What is the relation to Fibonacci? Add up the entries running along the shallow diagonals and you get the Fibonacci numbers, one after another.
And the Sierpinski triangle? Reduce the triangle modulo 2, paint the odd entries black, and the Sierpinski fractal pattern stares back at you.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.