Centered hexagonal numbers that are also perfect squares: Do they ever end?

A centered hexagonal number, is, for example, the total number of coins you’d get if you started with one central coin, then started building hexagons around it. A few, but only a few, are also perfect squares. How few?

*In the first one million CHNs, there are only six that are also perfect squares (including the degenerate case ‘1’).

  1st...............................1 
  8th............................169 
105th......................32,761 

1456th…6,355,441
20273rd…1,232,922,769
282360th…239,180,661,721
The GQ: Can it be proved that there either a) there is an infinite number of CHNs that are also perfect squares, but they jest get farther and farther apart, or b) there is a finite number?

I suspect that there is an infinite number, but don’t know how to prove it, or whether it is provable.

*If my calculations are correct–and that’s not a given, so if I’ve missed something feel free to get me up to speed.

The formula for the hex numbers is 3n^2 - 3n +1. You want that to equal m^2. This is a Diophantine equation. I don’t know if there are an infinite number of pairs, but is probably where to start.

Here’s the Online Encyclopedia of Integer Sequences page for that sequence 1,169,32761,6355441 - OEIS . Looks like there’s an infinite number of them.

From the above site:

Here’s how you get the nth number of that form, if you have the n-1th and the n-2th

a(n) = 194*a(n-1) - a(n-2) - 24 (start with a(1)=1, a(2)=169)

So there is an infinite number of them…

Also note that m must be odd (since the left hand member is always odd), so you can put m = 2p-1 and get the equation 3(n^2-n) = 4(p^2-2p), which seems just a tad simpler to work with.

ETA: Allright, already solved!

Thanks!

I don’t know if this will be helpful or not…

Define:
A[sub]1[/sub] = 1
A[sub]2[/sub] = 13
A[sub]n[/sub] = 14 A[sub]n-1[/sub] - A[sub]n-2[/sub] for n >= 3

B[sub]n[/sub] = (3 + sqrt(12 A[sub]n[/sub][sup]2[/sup] - 3))/6

Then
C[sub]n[/sub] = A[sub]n[/sub][sup]2[/sup] = 3 B[sub]n[/sub][sup]2[/sup] - 3 A[sub]n[/sub] + 1
is both the A[sub]n[/sub]th square number and B[sub]n[/sub]th centered hexagonal number.

Here’s an interesting bonus. With A[sub]n[/sub] and B[sub]n[/sub] defined as above, the limit of A[sub]n[/sub] / B[sub]n[/sub] as n goes to infinity is sqrt(3).

Correcting an error from earlier…

Then
C[sub]n[/sub] = A[sub]n[/sub][sup]2[/sup] = 3 B[sub]n[/sub][sup]2[/sup] - 3 B[sub]n[/sub] + 1
is both the A[sub]n[/sub]th square number and B[sub]n[/sub]th centered hexagonal number.

No problem. The OEIS is a fun tool.