The triangular numbers or triangle numbers are the sequence of positive integers that can be represented as a lattice of points arranged in an equilateral triangle. The triangular lattice representing the nth triangular number contains n rows: the first row contains one point, the second row contains two, and this pattern continues up to the nth row, which contains n. Therefore, the triangular numbers may also be represented by the formula. Tn=1+2+3+⋯+(n−1)+n=∑k=1nk. Triangular numbers are the simplest kind of figurate number – figurate numbers generalize their concept to other two-dimensional polygons, such as the pentagonal numbers, as well as higher-dimensional polyhedra, such as the tetrahedral numbers. Taking T0=0 (see empty sum), the first few terms are
(sequence A000217 in the OEIS)
Formula
The triangular numbers are given by the following explicit formulas:
where (n+12) is notation for a binomial coefficient. It represents the number of distinct pairs that can be selected from n + 1 objects, and it is read aloud as "n plus one choose two". The fact that the nth triangular number equals n(n+1)/2 can be illustrated using a visual proof. For every triangular number Tn, imagine a "half-rectangle" arrangement of objects corresponding to the triangular number, as in the figure below. Copying this arrangement and rotating it to create a rectangular figure doubles the number of objects, producing a rectangle with dimensions n×(n+1), which is also the number of objects in the rectangle. Clearly, the triangular number itself is always exactly half of the number of objects in such a figure, or: Tn=n(n+1)2. The example T4 follows:
This formula can be proven formally using mathematical induction. It is clearly true for 1: T1=∑k=11k=1(1+1)2=22=1. Now assume that, for some natural number m, Tm=∑k=1mk=m(m+1)2. We can then verify it for m+1: ∑k=1m+1k=∑k=1mk+(m+1)=m(m+1)2+m+1=m2+m2+2m+22=m2+3m+22=(m+1)(m+2)2, so if the formula is true for m, it is true for m+1. Since it is clearly true for 1, it is therefore true for 2, 3, and ultimately all natural numbers n by induction. An apocryphal story claims that the German mathematician Gauss found this relationship in his early youth, by multiplying n/2 pairs of numbers in the sum by the values of each pair n + 1. In any case, Gauss was not the first to discover this formula, and some find it likely that its origin goes back to the Pythagoreans in the 5th century BC. The two formulas were described by the Irish monk Dicuil in about 816 in his Computus. An English translation of Dicuil's account is available. Occasionally it is necessary to compute large triangular numbers where the standard formula t = n*(n+1)/2 would suffer integer overflow before the final division by 2. For example, T20 = 210 < 256, so will fit into an 8-bit byte, but not the intermediate product 420. This can be solved by dividing either n or n+1 by 2 before the multiplication, whichever is even. This does not require a conditional branch if implemented as t = (n|1) * ((n+1)/2). If n is odd, the binary OR operation n|1 has no effect, so this is equivalent to t = n * ((n+1)/2) and thus correct. If n is even, setting the low bit with n|1 is the same as adding 1, while the 1 added before the division is truncated away, so this is equivalent to t = (n+1) * (n/2) and also correct.
Relations to other figurate numbers Triangular numbers have a wide variety of relations to other figurate numbers. Most simply, the sum of two consecutive triangular numbers is a square number, since:
Tn−1+Tn =12n(n−1)+12n(n+1) =12n((n−1)+(n+1)) =n2 with the sum being the square of the difference between the two (and thus the difference of the two being the square root of the sum): Tn+Tn−1=(n22+n2)+((n−1)22+n−1(n−1)22)=(n22+n2)+(n22−n2)=n2=(Tn−Tn−1)2. This property, colloquially known as the theorem of Theon of Smyrna, is visually demonstrated in the following sum, which represents T4+T5=52 as digit sums: 4321+1234555555 This fact can also be demonstrated graphically by positioning the triangles in opposite directions to create a square:
The double of a triangular number, as in the visual proof from the above section § Formula, is called a pronic number. There are infinitely many triangular numbers that are also square numbers; e.g., 1, 36, 1225. Some of them can be generated by a simple recursive formula: Sn+1=4Sn(8Sn+1) with S1=1. All square triangular numbers are found from the recursion Sn=34Sn−1−Sn−2+2 with S0=0 and S1=1.
The square of the nth triangular number is also the same as the sum of the cubes of the integers 1 to n. This can also be expressed as ∑k=1nk3=(∑k=1nk)2.
The sum of the first n triangular numbers is the nth tetrahedral number: ∑k=1nTk=∑k=1nk(k+1)2=n(n+1)(n+2)6. More generally, the difference between the nth m-gonal number and the nth (m + 1)-gonal number is the (n − 1)th triangular number. For example, the sixth heptagonal number (81) minus the sixth hexagonal number (66) equals the fifth triangular number, 15. Every other triangular number is a hexagonal number. Knowing the triangular numbers, one can reckon any centered polygonal number; the nth centered k-gonal number is obtained by the formula Ckn=kTn−1+1 where T is a triangular number. The positive difference of two triangular numbers is a trapezoidal number. The pattern found for triangular numbers ∑n1=1n2n1=(n2+12) and for tetrahedral numbers ∑n2=1n3∑n1=1n2n1=(n3+23), which uses binomial coefficients, can be generalized. This leads to the formula: ∑nk−1=1nk∑nk−2=1nk−1⋯∑n2=1n3∑n1=1n2n1=(nk+k−1k)
Other properties Triangular numbers correspond to the first-degree case of Faulhaber's formula.
Alternating triangular numbers (1, 6, 15, 28, ...) are also hexagonal numbers. Every even perfect number is triangular (as well as hexagonal), given by the formula Mp2p−1=Mp(Mp+1)2=TMp where Mp is a Mersenne prime. No odd perfect numbers are known; hence, all known perfect numbers are triangular. For example, the third triangular number is (3 × 2 =) 6, the seventh is (7 × 4 =) 28, the 31st is (31 × 16 =) 496, and the 127th is (127 × 64 =) 8128. The final digit of a triangular number is 0, 1, 3, 5, 6, or 8, and thus such numbers never end in 2, 4, 7, or 9. A final 3 must be preceded by a 0 or 5; a final 8 must be preceded by a 2 or 7. In base 10, the digital root of a nonzero triangular number is always 1, 3, 6, or 9. Hence, every triangular number is either divisible by three or has a remainder of 1 when divided by 9:
… excerpt ends here. Continue reading the full article.





