Centered hexagonal number

In mathematics and combinatorics, a centered hexagonal number, or hex number, is a centered figurate number that represents a hexagon with a dot in the center and all other dots surrounding the center dot in a hexagonal lattice. The following figures illustrate this arrangement for the first four centered hexagonal numbers:
 * {|style="min-width: 325px;"|

! 1 !! !! 7 !! !! 19 !! !! 37
 * - style="text-align:center; color:red; vertical-align:middle;"
 * +1 || || +6 || || +12 || || +18


 * - style="vertical-align:middle; text-align:center; line-height:1.1em;"
 * [[Image:RedDotX.svg|16px|*]]
 * [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]]
 * [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]]
 * [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]]
 * }
 * [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:GrayDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]] [[Image:RedDotX.svg|16px|*]]
 * }
 * }

Centered hexagonal numbers should not be confused with cornered hexagonal numbers, which are figurate numbers in which the associated hexagons share a vertex.

The sequence of hexagonal numbers starts out as follows :


 * 1, 7, 19, 37, 61, 91, 127, 169, 217, 271, 331, 397, 469, 547, 631, 721, 817, 919.

Formula


The $n$th centered hexagonal number is given by the formula


 * $$H(n) = n^3 - (n-1)^3 = 3n(n-1)+1 = 3n^2 - 3n +1. \,$$

Expressing the formula as


 * $$H(n) = 1+6\left(\frac{n(n-1)}{2}\right)$$

shows that the centered hexagonal number for $n$ is 1 more than 6 times the $n(n−1)$th triangular number.

In the opposite direction, the index $n$ corresponding to the centered hexagonal number $$H = H(n)$$ can be calculated using the formula


 * $$n=\frac{3+\sqrt{12H-3}}{6}.$$

This can be used as a test for whether a number $H$ is centered hexagonal: it will be if and only if the above expression is an integer.

Recurrence and generating function
The centered hexagonal numbers $$H(n)$$ satisfy the recurrence relation


 * $$H(n+1) = H(n) + 6n.$$

From this we can calculate the generating function $$F(x) = \sum_{n \ge 0} H(x) x^n$$. The generating function satisfies


 * $$F(x) = x + xF(x) + \sum_{n \ge 2} 6n x^n.$$

The latter term is the Taylor series of $$\frac{6x}{(1-x)^2} - 6x$$, so we get


 * $$(1 - x) F(x) = x + \frac{6x}{(1-x)^2} - 6x = \frac{x + 4x^2 + x^3}{(1-x)^2}$$

and end up at


 * $$F(x) = \frac{x + 4x^2 + x^3}{(1-x)^3}.$$

Properties
In base 10 one can notice that the hexagonal numbers' rightmost (least significant) digits follow the pattern 1–7–9–7–1 (repeating with period 5). This follows from the last digit of the triangle numbers which repeat 0-1-3-1-0 when taken modulo 5. In base 6 the rightmost digit is always 1: 16, 116, 316, 1016, 1416, 2316, 3316, 4416... This follows from the fact that every centered hexagonal number modulo 6 (=106) equals 1.

The sum of the first $n$ centered hexagonal numbers is $(n − 1)$. That is, centered hexagonal pyramidal numbers and cubes are the same numbers, but they represent different shapes. Viewed from the opposite perspective, centered hexagonal numbers are differences of two consecutive cubes, so that the centered hexagonal numbers are the gnomon of the cubes. (This can be seen geometrically from the diagram.) In particular, prime centered hexagonal numbers are cuban primes.

The difference between $n^{3}$ and the $n$th centered hexagonal number is a number of the form $(2n)^{2}$, while the difference between $3n^{2} + 3n − 1$ and the $n$th centered hexagonal number is a pronic number.

Applications
Many segmented mirror reflecting telescopes have primary mirrors comprising a centered hexagonal number of segments (neglecting the central segment removed to allow passage of light) to simplify the control system. Some examples: