test for hexagonal numbers

Given an arbitrary positive integer n, one can determine whether or not it is a hexagonal numberMathworldPlanetmath by calculating


If x is an integer, (that is, x), then n is a hexagonal number. If n is a triangular numberMathworldPlanetmath but not a hexagonal number, then x=y2, with y being an odd integer. In all other cases, x will be an irrational number.

It will suffice to work out an example of each. We choose 1729, 277770576188160 and 1900221452387519291741168640. With the exception of 1729, these numbers have been deliberately chosen so that they would be so big that in Sloane’s OEIS they would be crowded out by much smaller numbers.

1729 has many properties, and it is relevant here to note that is 12-gonal and 24-gonal. But is it hexagonal?

x =1+1+8×17294

Though 1729 is a figurate numberMathworldPlanetmath in a few different ways, hexagonal is not among them.

Given n set to 277770576188160, x=235699212. Clearly this is a rational numberPlanetmathPlanetmathPlanetmath, but not an integer. This tells us that 277770576188160 is a triangular number but not a hexagonal number.

Given 1900221452387519291741168640, our x is 30823866178560, an integer. If we plug in this integer into the formulaMathworldPlanetmathPlanetmath for hexagonal numbers, we should get 1900221452387519291741168640 back, confirming that this number is in fact the 30823866178560th hexagonal number.

Title test for hexagonal numbers
Canonical name TestForHexagonalNumbers
Date of creation 2013-03-22 17:50:54
Last modified on 2013-03-22 17:50:54
Owner PrimeFan (13766)
Last modified by PrimeFan (13766)
Numerical id 6
Author PrimeFan (13766)
Entry type Result
Classification msc 11D09