Hexagonal Number

Author

Eric W. Weisstein
September 29, 2007

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

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

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

Values

HexagonalNumber[n]

HexagonalNumber[Range[10]]

Figure

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

Representation as a Sum of Hexagonal Numbers

hex=HexagonalNumber[Range[0,10]];

NotRepresentable[l_,n_]:=Complement[Range[0,Last[l]],Select[Union[Total/@Subsets[Flatten[Transpose[Table[l,{n}]]],{n}]],#≤Last[l]&]]

Not Representable as a sum of 4 hexagonal numbers

NotRepresentable[hex,4]//Timing

Length[Last[%]]

Not Representable as a sum of 5 hexagonal numbers

NotRepresentable[hex,5]//Timing

Not Representable as a sum of 6 hexagonal numbers

NotRepresentable[HexagonalNumber[Range[0,7]],6]//Timing

Generating Function

<<DiscreteMath`RSolve`

gf=FullSimplify[PowerSum[HexagonalNumber[n],{x,n}]]

Series[gf,{x,0,5}]