The first six triangular numbers (not starting withT0, but rather,T1)Triangular Numbers Plot
Atriangular number ortriangle number counts objects arranged in anequilateral triangle. Triangular numbers are a type offigurate number, other examples beingsquare numbers andcube numbers. Thenth triangular number is the number of dots in the triangular arrangement withn dots on each side, and is equal to the sum of thennatural numbers from 1 ton. The first 100 termssequence of triangular numbers, starting with the0th triangular number, are
The triangular numbers are given by the following explicit formulas:
where is notation for abinomial coefficient. It represents the number of distinct pairs that can be selected fromn + 1 objects, and it is read aloud as "n plus one choose two".
The fact that theth triangular number equals can be illustrated using avisual proof.[1] For every triangular number, 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, 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:. The example follows:
Now assume that, for some natural number,. We can then verify it for:
so if the formula is true for, it is true for. Since it is clearly true for, it is therefore true for,, and ultimately all natural numbers by induction.
An apocryphal story claims that the German mathematicianGauss found this relationship in his early youth, by multiplyingn/2 pairs of numbers in the sum by the values of each pairn + 1.[3] In any case, Gauss was not the first to discover this formula, and some find it likely that its origin goes back to thePythagoreans in the 5th century BC.[4] The two formulas were described by the Irish monkDicuil in about 816 in hisComputus.[5] An English translation of Dicuil's account is available.[6]
Occasionally it is necessary to compute large triangular numbers where the standard formulat = n*(n+1)/2 would sufferinteger overflow before the final division by 2. For example,T20 = 210 < 256, so will fit into an8-bit byte, but not the intermediate product 420. This can be solved by dividing eithern orn+1 by 2 before the multiplication, whichever is even. This does not require aconditional branch if implemented ast = (n|1) * ((n+1)/2). Ifn is odd, thebinary OR operationn|1 has no effect, so this is equivalent tot = n * ((n+1)/2) and thus correct. Ifn is even, setting the low bit withn|1 is the same as adding 1, while the 1 added before the division istruncated away, so this is equivalent tot = (n+1) * (n/2) and also correct.
All square triangular numbers are found from the recursion with and
A square whose side length is a triangular number can be partitioned into squares and half-squares whose areas add to cubes. This shows that the square of thenth triangular number is equal to the sum of the firstn cube numbers.
More generally, the difference between thenthm-gonal number and thenth(m + 1)-gonal number is the(n − 1)th triangular number. For example, the sixthheptagonal number (81) minus the sixthhexagonal number (66) equals the fifth triangular number, 15. Every other triangular number is a hexagonal number. Knowing the triangular numbers, one can reckon anycentered polygonal number; thenth centeredk-gonal number is obtained by the formula
whereT is a triangular number.
The positive difference of two triangular numbers is atrapezoidal number.
The pattern found for triangular numbers and for tetrahedral numbers which usesbinomial coefficients, can be generalized. This leads to the formula:[11]
The fourth triangular number equals the third tetrahedral number as thenthk-simplex number equals thekthn-simplex number due to the symmetry ofPascal's triangle, and its diagonals being simplex numbers; similarly, the fifth triangular number (15) equals the thirdpentatope number, and so forth
Triangular numbers correspond to the first-degree case ofFaulhaber's formula.
{{{annotations}}}
Proof without words that all hexagonal numbers are odd-sided triangular numbers
Alternating triangular numbers (1, 6, 15, 28, ...) are also hexagonal numbers.
Every evenperfect number is triangular (as well as hexagonal), given by the formulawhereMp is aMersenne 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.
Inbase 10, thedigital 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:
The digital root pattern for triangular numbers, repeating every nine terms, as shown above, is "1, 3, 6, 1, 6, 3, 1, 9, 9".
The converse of the statement above is, however, not always true. For example, the digital root of 12, which is not a triangular number, is 3 and divisible by three.
Ifx is a triangular number,a is an odd square, andb =a − 1/8, thenax +b is also a triangular number. Note thatb will always be a triangular number, because8Tn + 1 = (2n + 1)2, which yields all the odd squares are revealed by multiplying a triangular number by 8 and adding 1, and the process forb givena is an odd square is the inverse of this operation.The first several pairs of this form (not counting1x + 0) are:9x + 1,25x + 3,49x + 6,81x + 10,121x + 15,169x + 21, ... etc. Givenx is equal toTn, these formulas yieldT3n + 1,T5n + 2,T7n + 3,T9n + 4, and so on.
The sum of thereciprocals of all the nonzero triangular numbers is
In addition, thenth partial sum of this series can be written as:
Two other formulas regarding triangular numbers areandboth of which can be established either by looking at dot patterns (see above) or with some simple algebra.
In 1796, Gauss discovered that every positive integer is representable as a sum of three triangular numbers, writing in his diary his famous words, "ΕΥΡΗΚΑ!num = Δ + Δ + Δ". The three triangular numbers are not necessarily distinct, or nonzero; for example 20 = 10 + 10 + 0. This is a special case of theFermat polygonal number theorem.
The number of line segments between closest pairs of dots in the triangle can be represented in terms of the number of dots or with arecurrence relation:
In thelimit, the ratio between the two numbers, dots and line segments is
Proof without words that the number of possible handshakes between n people is the (n−1)th triangular number
The triangular numberTn solves thehandshake problem of counting the number of handshakes if each person in a room withn + 1 people shakes hands once with each person. In other words, the solution to the handshake problem ofn people isTn−1.[16]
Equivalently, afully connected network ofn computing devices requires the presence ofTn − 1 cables or other connections.
A triangular number is equivalent to the number of principal rotations in dimension. For example, in five dimensions the number of principal rotations is 10 which is.[17]
In a tournament format that uses a round-robingroup stage, the number of matches that need to be played betweenn teams is equal to the triangular numberTn − 1. For example, a group stage with 4 teams requires 6 matches, and a group stage with 8 teams requires 28 matches. This is also equivalent to the handshake problem and fully connected network problems.
The maximum number of pieces,p obtainable withn straight cuts is then-th triangular number plus one, forming the lazy caterer's sequence (OEIS A000124)
One way of calculating thedepreciation of an asset is thesum-of-years' digits method, which involves findingTn, wheren is the length in years of the asset's useful life. Each year, the item loses(b −s) ×n −y/Tn, whereb is the item's beginning value (in units of currency),s is its final salvage value,n is the total number of years the item is usable, andy the current year in the depreciation schedule. Under this method, an item with a usable life ofn = 4 years would lose4/10 of its "losable" value in the first year,3/10 in the second,2/10 in the third, and1/10 in the fourth, accumulating a total depreciation of10/10 (the whole) of the losable value.
Board game designers Geoffrey Engelstein and Isaac Shalev describe triangular numbers as having achieved "nearly the status of a mantra or koan amonggame designers", describing them as "deeply intuitive" and "featured in an enormous number of games, [proving] incredibly versatile at providing escalating rewards for larger sets without overly incentivizing specialization to the exclusion of all other strategies".[18]
Relationship between the maximum number of pips on an end of adomino and the number of dominoes in its set (values in bold are common)
By analogy with thesquare root ofx, one can define the (positive) triangular root ofx as the numbern such thatTn =x:[19]
which follows immediately from thequadratic formula. So an integerx is triangularif and only if8x + 1 is a square. Equivalently, if the positive triangular rootn ofx is an integer, thenx is thenth triangular number.[19]
By analogy with thefactorial function, a product whose factors are the integers from 1 to n,Donald Knuth proposed the nameTermial function,[20] with the notationn? for the sum whose terms are the integers from 1 to n (thenth triangular number). Although some other sources use this name and notation,[21] they are not in wide use.
Hypertetrahedral Polytopic Roots by Rob Hubbard, including the generalisation totriangular cube roots, some higher dimensions, and some approximate formulas