# Are there infinitely-many numbers that are both square and triangular?

I just started to read "Friendly Introduction to Number Theory" but I am getting stuck in the first exercises.

1.1. The first two numbers that are both squares and triangles are 1 and 36. Find the next one and, if possible, the one after that. Can you figure out an efficient way to find triangular–square numbers? Do you think that there are infinitely many?

https://www.math.brown.edu/~jhs/frintch1ch6.pdf

I found how to find out the number which is both square and triangle. (don't know if this is effective way)

https://github.com/y-zono/friendly-introduction-number-theory/blob/master/01/1-1/main.go

However how can I answer "Do you think that there are infinitely many?"? I think I need to find the formula but no idea yet. Can you please help me?

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}$$

• Thank you so much! Give me for a while to understand it. So many information for me. I think it will take few days..
– zono
Commented Oct 15, 2018 at 11:30

Assume that $$\frac{n(n+1)}{2}=m^2\iff n(n+1)=2m^2$$ Since $$\gcd(n,n+1)=1$$ we need to factor $$m^2$$ as $$m^2=a^2b^2$$ with $$\gcd(a,b)=1$$. Assume without loss of generality that $$a^2\leq b^2$$, then there are 3 cases to consider given that now $$n(n+1)=2a^2b^2$$

1. $$n=a^2, n+1=2b^2$$. Then $$1=2b^2-a^2\geq b^2$$ so $$a=b=\pm 1$$.

2. $$n=2a^2, n+1=b^2$$. Then $$1=b^2-2a^2$$ One solution to this is $$(a,b)=(2,3)$$, and we can always generate a new solution by $$(a',b')=(2ab, b^2+2a^2)$$ The motivation for this is to consider the equation $$1=b^2-2a^2$$ over the ring $$\Bbb Z[\sqrt 2]$$, with norm $$N(a+b\sqrt 2)=a^2-2b^2$$. Then $$N(\alpha\beta)=N(\alpha)N(\beta)$$, in particular if $$N(\alpha)=1$$ then $$N(\alpha^n)=1$$.

3. $$n=b^2, n+1=2a^2$$. Then $$1=2a^2-b^2$$ multiply by $$2$$ to make the equation into $$2=(2a)^2-2b^2=(2a+\sqrt 2 b)(2a-\sqrt 2 b)\in\Bbb Z[\sqrt 2]$$ one solution to this equation is $$(a,b)=(1,1)$$. To generate more solutions we may multiply by any unit $$u$$, for instance $$u=3+2\sqrt 2$$. $$(2a+\sqrt 2 b)(3+2\sqrt 2)=6a+4b+(4a+3b)\sqrt 2$$. $$2=(10+7\sqrt 2)(10-7\sqrt 2)$$, so $$1=2\cdot 5^2-7^2$$ Therefore $$(a',b')=(3a+2b, 4a+3b)$$ and so there are also infinitely many solutions in this case also.

• This is by far the best answer. Why didn't it have any upvotes? I guess because it was answered two years later... Commented Mar 4, 2021 at 11:57

Have a look at https://en.wikipedia.org/wiki/Square_triangular_number So, the answere is yes!

• Thank you for great reference. I did not know the term "Square triangular number".
– zono
Commented Oct 15, 2018 at 11:24
• Almost a link-only answer..... (at least it says the answer is yes if the link breaks) Commented Oct 15, 2018 at 14:18

The formula for triangle numbers is on page 9. Create an equation with the left being that formula using x, and the right the formula for squares, using y. X and y are not equal, but you can rearrange terms. Ask, when is the left divisible by something on the right? Are we sure that such divisibility exists for higher numbers?

Better, assume we have such an x and y. Can we always add something to each to get the next number?

• Thank you! Now I'm trying to understand what you are saying... not easy for me. (my English skills is not good too)
– zono
Commented Oct 15, 2018 at 11:27
• Good luck to you. The other answers are very detailed, but you have to do only enough to answer the question, are there infinitely many? I read the chapter, and it wants you to think about things that we can show go on forever, and other things that are conjectures (twin primes is one... we think it goes on forever but we do not know.)
– Russ
Commented Oct 15, 2018 at 11:57
• Also, thank you for trying before asking, and welcome to the board! :-)
– Russ
Commented Oct 15, 2018 at 11:59

There is a closely related problem. Do their exists an infinite number of triples (x,y,z) such that x,y,and z are consecutive integers each being expressible as the sum of two not necessarily distinct integer squares? For example $$0=0^2+0^2;1=0^2+1^2;2=1^2+1^2$$ $$8=2^2+2^2; 9=0^2+3^2; 10=3^2+1^2$$.

In the latter case, the triple takes the form $$2m^2+2=n^2+1$$, or $$n^2-2m^2=1$$ Pell's equation again.

So if you can construct or prove the existence of an infinite number of such triples, you have found an infinite number of square triangular numbers.

• What about $4m^4+4m^2, 4m^4+4m^2+1, 4m^4+4m^2+2$? Commented Jan 1, 2021 at 15:37