0
$\begingroup$

I'm looking for a list of numbers. Every number in the list must be triangular, square, and hexagonal.

As it turns out, every hexagonal number is also a triangular number. So my question is equivalent to a list of numbers where each one is square and hexagonal.

I took a look at the first few hexagonal numbers:

1, 6, 15, 28, 45, 66, 91, 120, 153, 190, 231, 276, 325, 378, 435, 496, 561, 630, 703, 780, 861, 946, ...

I do not recognize any perfect squares in there. Does my list exist?

I of course also took a look at the formula for hexagonal numbers:

$$H_n = 2n^2 - n$$

However, we are not trying to make an $n^2$ out of this. $n$ in this formula represents the nth hexagonal number. We just want the formula to equal the square of some integer, any integer. In other words we want:

$$2n^2 - n = x^2$$ where $x$ and $n$ are any positive integers. I say positive integers to exclude the trivial case of $x = n = 0$. I'm not sure if zero can be considered square and hexagonal numbers, depending on the exact definition. (There was even an argument that zero was prime, because if not, then it must be composite, and what are the factors of zero? It all depends on precise definitions.)

Anyway, the equation $2n^2 - n = x^2$ cannot be solved for what I'm looking for in the normal way. The best I can do is say $x = \sqrt{2n^2 - n}$ and wonder if any $2n^2 - n$, where n is integer, is a perfect square? (That is basically the same thing as the original equation, wondering if it's a perfect square.)

$\endgroup$
  • $\begingroup$ A practical answer to "does my list exist": Yes, here: oeis.org/A008844 $\endgroup$ – Simon Mar 8 '17 at 9:07
  • $\begingroup$ @Simon That series starts 1, 25, 841, 28561, but 25 and 841 are not hexagonal numbers. It also skips over 1225 which user:Galc127 found is both square and hex. The text mentions hex nums but I don't know how to extract that info from the series. $\endgroup$ – DrZ214 Mar 8 '17 at 9:13
  • 1
    $\begingroup$ oups, my bad. The correct sequence is oeis.org/A046177 $\endgroup$ – Simon Mar 8 '17 at 9:15
  • $\begingroup$ @Simon Yup that's it, thanks. $\endgroup$ – DrZ214 Mar 8 '17 at 9:17
3
$\begingroup$

Using the common method for solving the quadratic equation $2n^2-n-x^2=0$ yields

$$n=\frac{1\pm\sqrt{1+8x^2}}{4}$$

Of course, since $n$ is positive, we'll take the positive sign.

For $n$ to be an integer in the equality above, $1+8x^2$ must be itself a perfect square, say $k^2$. Moreover, we must have $k\equiv 3\pmod4$ for the numerator to be divisible by $4$. The equation then becomes

$$k^2-8x^2=1$$

and this is a well known kind of diophantine equation, the Pell equation.

The fundamental solution $(k_1,x_1)$ is $(3,1)$, obtained from the convergents of the continued fraction for $\sqrt{8}=[2;\overline{1,4}]$. All other solutions $(k_i,x_i)$ can be otained via the recursion

\begin{align} k_{i+1}&=k_1k_i+8x_1x_i=3k_i+8x_i\\ x_{i+1}&=k_1x_i+x_1k_i\hphantom{8}=3x_i+k_i \end{align}

Now, not all solutions here are good for us, because of the modulo $4$ constraint on $k$. Indeed, we see that $(k_2,x_2)=(17,6)$ is no good for us, but $(k_3,x_3)=(99,35)$ is.

The recursion implies that $k_{i+1}\pmod4\equiv3k_i$. Since $k_1\equiv3\pmod4$, it follows that $k_{2j}\equiv1\pmod4$ and $k_{2j+1}\equiv3\pmod4$. In other words, only the odd terms of the recursion will be of use to us.

This way, we find the first few pairs $(k,x,n)$:

\begin{array}{c|c|c} k&x&n\\ \hline 3&1&1\\ 99&35&25\\ 3363&1189&841\\ 114243&40391&28561\\ 3880899&1372105&970225\\ \hline \end{array}

Of course, there are infinitely many solutions.


EDIT: We may use linear algebra to solve the recursion. Indeed the system can be written as

$$ \pmatrix{k_{i+1}\\x_{i+1}}=\underbrace{\pmatrix{3&8\\1&3}}_A\pmatrix{k_i\\x_i}. $$

Noticing that $\pmatrix{k_1\\x_1}=A\pmatrix{1\\0}$, it follows that

$$ \pmatrix{k_i\\x_i}=A^i\pmatrix{1\\0}. $$

We may diagonalize $A$ to find that $A=PDP^{-1}$, where

\begin{align} P=\pmatrix{-2\sqrt{2}&2\sqrt{2}\\1&1}&& D=\pmatrix{3-2\sqrt{2}&0\\0&3+2\sqrt{2}}&& P^{-1}=\pmatrix{-\frac{\sqrt{2}}8&\frac12\\\frac{\sqrt{2}}8&\frac12} \end{align}

so that finally

$$ \pmatrix{k_i\\x_i} =\pmatrix{\frac12\Big({(3+2\sqrt{2})}^i+{(3-2\sqrt{2})}^i\Big)\\\frac{\sqrt2}8\Big({(3+2\sqrt{2})}^i-{(3-2\sqrt{2})}^i\Big)} =\pmatrix{\Big\lceil\frac12{\left(3+2\sqrt{2}\right)}^i\Big\rceil \\ \Big\lfloor\frac{\sqrt{2}}8{\left(3+2\sqrt{2}\right)}^i\Big\rfloor} $$

But remember, we're only interested in odd $i$. The corresponding $n_i$ is given by

$$n_i=\frac14\left(1+\sqrt{1+\left\lfloor\frac14{\left(3+2\sqrt{2}\right)}^{2i}\right\rfloor}\right)$$

$\endgroup$
  • $\begingroup$ Oops, your comment underlines a grave mistake in my answer. I will rewrite it. $\endgroup$ – Fimpellizieri Mar 8 '17 at 8:18
  • $\begingroup$ @Galc127 It should be good now. $\endgroup$ – Fimpellizieri Mar 8 '17 at 8:52
  • $\begingroup$ Thanks for a very detailed solution :) $\endgroup$ – Galc127 Mar 8 '17 at 8:55
  • $\begingroup$ I followed until you got to Pell's Equation. Below that, are you just trying to solve the general form of it? Also, what does K = 3 (mod 4) mean exactly? If it's modulo arithmetic, then 3 % 4 = 3, but what does the triple equal sign mean? $\endgroup$ – DrZ214 Mar 8 '17 at 9:36
  • $\begingroup$ Below that, I provide a sort of step by step solution of the Pell equation, and point out that we are only interested in some of the solutions. I then find a closed form expression for the solutions using linear algebra. Yes, it's modulo arithmethic. It means 'equivalent to' or 'congruent to'. It's just a way to emphasize that it is not equality in the usual, non-modular sense. $\endgroup$ – Fimpellizieri Mar 8 '17 at 9:42
2
$\begingroup$

First some examples: $$H_1=1=1^2,\, H_{25}=1225=35^2,\, H_{841}=1413721=1189^2,\, H_{28561}=1631432881=40391^2$$ and so on.

The equation is $2n^2-n=x^2$. Multiply by $8$ we have $$16n^2-8n=8x^2\implies (4n-1)^2-8x^2=1$$ Let $a=4n-1$ and $b=2x$ we get the equation $$a^2-2b^2=1$$ which is a simple pell equation. Each solution $(a,b)$ of this equation implies corresponding $(n,x)$.

$\endgroup$
  • $\begingroup$ I've never heard of Pell's Equation before ($x^2 - ny^2 = 1$) and it is fascinating. Why in the world would infinite integer solutions exist for any n except square numbers? $\endgroup$ – DrZ214 Mar 8 '17 at 9:25
  • $\begingroup$ @DrZ214, assume that $n$ is square number, i.e $n=k^2$, hence the equation is $x^2-k^2y^2=1\implies (x-ky)(x+ky)=1$. Now, both factors have to be $1$ or $-1$. We find that $(x,y)$ are not integers and it is a contradiction, hence $n$ cannot be a square number. $\endgroup$ – Galc127 Mar 8 '17 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.