Triangular Number

Author

Eric W. Weisstein
November 7, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/IntegerSequences/TriangularNumber.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/TriangularNumber.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Definition

TriangularNumber[n]

Enumeration

TriangularNumber/@Range[10]

Position[TriangularNumber/@Range[10^5],_?PrimeQ]//Flatten//Timing

Either n or n+1 must be even, which means (Subscript[T, n])is a product of an even number divided by two and an odd number.  Hence, it cannot be an odd prime.

Figures

Diagrams

With[{n=3},
Show[GraphicsArray[Graphics[#,AspectRatio->Automatic,PlotRange->All]&/@Table[PolygonalDiagram[n,m,PointStyle->{PointSize[.1],Red}],{m,5}]]]
]

Binary Plot

<<Utilities`Plot`

Show[PixelPerfect[BasePlot[TriangularNumber/@Range[255]],BlockSize->2]]

Show[PixelPerfect[BasePlot[TriangularNumber/@Range[256,256+2 254]],BlockSize->1]]

Sums

(∑_k^n)k==(Subscript[T, n])==(1/2) n (n+1)

Sum[k,{k,n}]

(∑_k^(2 n-1))(((-1))^(k+1)) (Subscript[T, k])==(n^2)

Sum[(((-1))^(k+1))TriangularNumber[k],{k,2n-1}]

TriangularNumber[k]

Sum[(((-1))^(k+1))(1/2) k (1+k),{k,2n-1}]

Refine[%,n∈Integers]

(∑_k^n)(k^3)==(Subscript[T, n]^2)==(1/4) (n^2) (((n+1))^2)

Sum[(k^3),{k,n}]

(∑_k^n)(((2 k-1))^3)==(Subscript[T, 2 (n^2)-1])==(n^2) (2 (n^2)-1)

Sum[(((2k-1))^3),{k,n}]//Factor

TriangularNumber[2(n^2)-1]

Identities

((T(n-1))^2)+((T(n))^2)==T(m)

Solve[((TriangularNumber[n])^2)+((TriangularNumber[n-1])^2)==TriangularNumber[m],m]

((TriangularNumber[n])^2)+((TriangularNumber[n-1])^2)==TriangularNumber[n^2]//Simplify

((TriangularNumber[n])^2)+((TriangularNumber[n-1])^2)==TriangularNumber[-(n^2+1)]//Simplify

Relationship to hexagonal numbers

TriangularNumber[2n-1]==HexagonalNumber[n]

Relationship to pentagonal numbers

PentagonalNumber[n]==TriangularNumber[3n-1]/3

Squares that are also triangular

Reduce[(1/4) (n^2) (((1+n))^2)==(1/2) m (1+m)&&m>0&&n>0,{m,n},Integers]

Solve[n==ToRadicals[Root[-2 m-2 (m^2)+((#1)^2)+2 ((#1)^3)+((#1)^4)&,2]],m]

Position[Table[TriangularNumber[n]^2,{n,10^3}],_?TriangularQ]//Flatten//Timing

Position[Table[TriangularNumber[n]^2,{n,10^4}],_?TriangularQ]//Flatten//Timing

Position[Table[TriangularNumber[n]^2,{n,10^5}],_?TriangularQ]//Flatten//Timing

Position[Table[Root[-2 m-2 (m^2)+((#1)^2)+2 ((#1)^3)+((#1)^4)&,2],{m,10^5}],_Integer,1]//Flatten//Timing

Generating Function

FullSimplify[PowerSum[1/2 n(n+1),{x,n}]]

Series[x/(1-x)^3,{x,0,5}]

CoefficientList[%,x]

Series[(1+2x+x^2/2)Exp[x],{x,0,5}]

CoefficientList[%,x]Table[i!,{i,0,5}]