9
$\begingroup$

I am trying to find a general formula for triangular square numbers. I have calculated some terms of the triangular-square sequence ($TS_n$):

$TS_n=$1, 36, 1225, 41616, 1413721, 48024900, 1631432881, 55420693056 1882672131025, 63955431761796, 2172602007770041, 73804512832419600

I have managed to find that:

$m^2 = \frac{n(n+1)}{2}$

where $m$ is the $m^{th}$ term of the square number sequence, and $n$ is the $n^{th}$ term of the triangular numbers sequence.

Would anyone be able to point out anything that could help me derive a formula for the square-triangular sequence?

  • 0
    See also: http://math.stackexchange.com/questions/751316/which-triangular-numbers-are-also-squares2014-08-07

5 Answers 5

16

Since all triangular numbers are of the form $\frac{n(n+1)}{2}$, we must have the condition cited $ m^2=\frac{n(n+1)}{2}\tag{1} $ Equation $(1)$ is equivalent to $ 2 = \frac{(2n+1)^2-1}{(2m)^2}\tag{2} $ According to standard continued fraction theory, a rational approximation to $\sqrt{2}$ as good as $(2)$ must also be an approximant for the continued fraction of $\sqrt{2}$. So we must find an overestimate for $\sqrt{2}$ with an even denominator (continued fraction approximants alternate between over- and under-estimates). The continued fraction for $\sqrt{2}$ is $\{1;2,2,2,\dots\}$, so the sequences of numerators and denominators for the approximants satisfy $ \begin{array}{}a_k=2a_{k-1}+a_{k-2}&\text{ and }&b_k=2b_{k-1}+b_{k-2}\end{array}\tag{3} $ where $a_0=a_1=b_1=1$ and $b_0=0$. Computing the first few approximants, we get $ \frac{1}{1},\frac{3}{2},\frac{7}{5},\frac{17}{12},\frac{41}{29},\frac{99}{70},\dots\tag{4} $ It follows from $(3)$ that every other denominator is even, and that they correspond to the overestimates. Therefore, every other approximant yields a square triangular number.

Every other term of a sequence that satisfies $(3)$, also satisfies $ \begin{array}{}a_{2k}=6a_{2k-2}-a_{2k-4}\text{ and }b_{2k}=6b_{2k-2}-b_{2k-4}\end{array}\tag{5} $ where $a_0=1$, $a_2=3$, $b_0=0$, and $b_2=2$. Let $2n_k+1=a_{2k}$ and $2m_k=b_{2k}$. Applying $(5)$ yields $ \begin{array}{}n_k=6n_{k-1}-n_{k-2}+2\text{ and }m_k=6m_{k-1}-m_{k-2}\end{array}\tag{6} $ where $n_0=m_0=0$ and $n_1=m_1=1$.

Using standard recurrence methods, we can solve $(6)$ for $m_k$ to get $ \begin{align} m_k^2 &=\left(\frac{(3+2\sqrt{2})^k-(3-2\sqrt{2})^k}{4\sqrt{2}}\right)^2\\ &=\frac{(17+12\sqrt{2})^k+(17-12\sqrt{2})^k-2}{32}\tag{7} \end{align} $ Thus, the sequence $TS_k=m_k^2$.

  • 0
    Please read the answer again. Because $2=\frac{(2n+1)^2-1}{(2m)^2}$, $\frac{2m+1}{2n}$ is a very good approximation for $\sqrt2$. It is so good that it must be a continued fraction approximation to $\sqrt2$ (if $\left|\frac{p}{q}-\sqrt2\right|\le\frac1{2q^2}$, then $\frac{p}{q}$ is a continued fraction approximation). Since the continued fraction for $\sqrt2$ is $(1,2,2,2,\dots)$, we get the recurrence for the numerators and denominators. Every other approximation is an over-estimate and is odd over even, so we can compute $m$ and $n$ from $\frac{2n+1}{2m}$.2017-08-27
7

See this page: Square Triangular Numbers. In particular:

In 1778 Leonhard Euler determined the explicit formula: $ \left( \frac{(3 + 2\sqrt{2})^k - (3 - 2\sqrt{2})^k}{4\sqrt{2}} \right)^2.$

The wikipedia page above is very useful. It explains the connection to Pells Equation.

  • 0
    @Ray, there is a whole theory of solutions to Pell equations. If you have one solution, such as $(x_1,y_1)=(3,2)$, then you get the others from $x_k+y_k\sqrt2=(3+2\sqrt2)^k$.2011-10-26
3

I will post just a sketch of different solution, which I quite like. (With the hope that OP can do the rest of work by himself and/or someone will be able to provide some links to materials where similar approach is used and the details are not omitted.)

I like this approach because a) it has many pictures; b) it can be explained to someone who knows nothing about Pell's equation. (In fact, similar approach can be used for some special cases of Pell's equation, you can have a look here. These notes are written in Slovak language, but I guess that the equations and pictures there are sufficient to understand it.)

I have learned about this from diploma thesis of my classmate some years ago. (I do not know the exact title - I only have a ps file without title pages.) In fact, the notation I am using here and some of the pictures are taken from her thesis. I apologize for the quality of the pictures, but I did not know a good way how to convert them from ps format.

Let us start with the first picture.

Triangle=square Triangle=square

$\triangle_m = \square_n$ $\Rightarrow$ $\triangle_{2n-m-1}=2\triangle_{m-n}$
(I guess this is self-explaining - we basically just gave the intersection away. One only has to be careful with one thing - we must not forget to subtract one. We are not working with areas of triangles and squares, but with the number of stones that are placed in them.)

Now we have to solve a new problem - when is one triangular number twice as large as another one. We can try our luck with a picture again.

Triangle=2triangles Triangle=2trianglees

We see that $2\triangle_p=\triangle_q$ $\Rightarrow$ $\square_{q-p}=\triangle_{2p-q}$.

Combining the above, with some algebraic manipulation, we get that from each solution $(m,n)$ we get a new solution of the form $(3m-4n+1,3n-2m-1)$.

Some details to fill in (I am omitting the proofs):

  • If we start with a solution in positive integers different from (1,1), then the new solution is still positive and smaller.
  • The only case in which the new solution is not in positive integers is $m=n=1$.

If we prove the above facts then we can argue that from each solution we can descend in finitely many steps to the solution (1,1) and, the other way round, each solution can be generated from (1,1) using the recurrence: $ \begin{gather*} P_{n+1}=3P_n+4Q_n+1\\ Q_{n+1}=2P_n+3Q_n+1 \end{gather*} $

There are many ways how to solve this, I will sketch one of them. First, let us substitute $P_n=p_n+\frac12$, $Q_n=q_n$, which leads us to $ \begin{gather*} p_{n+1}=3p_n+4q_n\\ q_{n+1}=2p_n+3q_n \end{gather*} $ Now we can notice that $p_{n+1}\pm\sqrt{2}q_{n+1}=(3\pm2\sqrt2)p_n + (4\pm3\sqrt2)q_n=(3\pm2\sqrt2)(p_n\pm\sqrt2q_n)$. Hence both $p_n\pm\sqrt2q_n$ are geometric progressions and with some work we can express both $p_n$ and $q_n$ as a linear combination of $(3\pm2\sqrt2)^n$.

(Side note: Anyone who knows about eigenvectors, eigenvalues and diagonalization can see where the above numbers come from - so there is no need of guessing. The numbers $3\pm2\sqrt2$ are precisely the eigenvalues of the matrix $\begin{pmatrix}3&4\\2&4\end{pmatrix}$.)

P.S. If you have seen this "graphical approach" somewhere, I will be glad to learn about such references. I know only about these papers, where similar approach is used to show that $x^2=2y^2$ and $x^2=3y^2$ have no solutions.

1

${t_n} = \sum\limits_{k = 1}^n k = 1 + 2 + 3 + \cdots + n = \frac{{n\left( {n + 1} \right)}}{2} = n-th{\text{ triangular number}}$ ${s_m} = {\text{m-th square number}} = {m^2}$ ${s_m} = {t_n} \Rightarrow \frac{1}{2}n\left( {n + 1} \right) = {m^2}$ $\frac{1}{2}{\left( {n + \frac{1}{2}} \right)^2} = \frac{1}{2}\left( {{n^2} + n + \frac{1}{4}} \right) = \frac{1}{2}\left( {{n^2} + n} \right) + \frac{1}{8}$ $\frac{1}{2}n\left( {n + 1} \right) = \frac{1}{2}\left( {{n^2} + n} \right) = \frac{1}{2}{\left( {n + \frac{1}{2}} \right)^2} - \frac{1}{8} = {m^2}$ $\frac{1}{2}{\left( {n + \frac{1}{2}} \right)^2} - {m^2} = \frac{1}{8}$ $4{\left( {n + \frac{1}{2}} \right)^2} - 8{m^2} = 1$ $2 \cdot \left( {n + \frac{1}{2}} \right) \cdot 2\left( {n + \frac{1}{2}} \right) - 8{m^2} = 1$ ${\left( {2n + 1} \right)^2} - 8{m^2} = 1$ ${\left( {2n + 1} \right)^2} - 2 \cdot {\left( {2m} \right)^2} = 1$ $\boxed{w \equiv 2n + 1}$ $\boxed{z \equiv 2m}$ $\boxed{{w^2} - 2{z^2} = 1}$

Finding numbers that satisfy the last equation above isn't all that simple... so I found the first numbers that are both triangular and square using python

import pandas as pd import numpy as np triangluar_and_square = [] for n in np.arange(1,10000):     w = 2*n + 1     for m in np.arange(1,10000):         z = 2*m         if w*w - 2*z*z - 1 == 0:             triangluar_and_square.append([m*m,m,n]) triangular_and_square = pd.DataFrame(triangluar_and_square,                                      columns = ["Square (m-squared) + Trianglular","m","n"],                                       index = [1,2,3,4,5,6])  print(triangular_and_square)` 

Code output

$\begin{array}{*{20}{c}} & {{\rm{Square (}}{m^2}){\rm{ and Triangular}}}&& m&& n& \\ \hline & 1&& 1&& 1& \\ & {36}&& 6&& 8& \\ & {1225}&& {35}&& {49}& \\ & {41616}&& {204}&& {288}& \\ & {1413721}&& {1189}&& {1681}& \\ & {48024900}&& {6930}&& {9800}& \end{array}$

0

Of course the solution of equation:

$Y^2=\frac{X(X\pm1)}{2}$

Defined solutions of Pell's equation: $p^2-2s^2=\pm1$

But it is necessary to write the formula describing their solutions through solving Pell's equation:

$X=p^2+4ps+4s^2$

$Y=p^2+3ps+2s^2$

And more.

$X=2s^2$

$Y=ps$

$p,s$ - These numbers can be any character.

If you need to have a solution of the equation: $Y^2=\frac{X(X\pm{a})}{2}$

It is necessary to substitute into the formulas uravneniyaPellya solutions: $p^2-2s^2=\pm{a}$