Let denote the th hexagonal number and the th square number, then a number which is both hexagonal and square satisfies the equation , or
(1)
|
Completing the square and rearranging gives
(2)
|
Therefore, defining
(3)
| |||
(4)
|
gives the Pell equation
(5)
|
The first few solutions are , (17, 12), (99, 70), (577, 408), .... These give the solutions , (9/2, 6), (25, 35), (289/2, 204), ..., giving the integer solutions (1, 1), (25, 35), (841, 1189), (28561, 40391), ... (OEIS A008844 and A046176). The corresponding hexagonal square numbers are 1, 1225, 1413721, 1631432881, 1882672131025, ... (OEIS A046177).
Closed-form solutions are
(6)
| |||
(7)
|
giving the th hexagonal square number as
(8)
|
A recurrence relation for is given by
(9)
|
with , where (M. Carreira, pers. comm., Sept. 11, 2004).