Mini-Challenge #5: Answer

What is the smallest square triangular number whose triangular side is the square of a composite number?

The answer is 1882672131025, which is the square of 1372105, and also the "triangle" of 1940449. Then 1940449 is 1393 squared, and 1393 is 7 x 199, so is composite.

Congratulations to @Varkora who was the first to get in contact with the correct answer.

Squares of side s are given by the formula s2. Triangles of side t are given by the formula t (t + 1) / 2.

Here's a table of the first few square triangular numbers greater than 1:

 N = s2 = t(t+1)/2
 s
 t
Integer root of t?
 Factors?
 36 6
 8 - 
 1225 35 49 7 Prime
 41616 204 288 - 
 1413721 1189 1681 41 Prime
 48024900 6930 9800 - 
 1631432881 40391 57121 239 Prime
 55420693056 235416 332928 - 
 1882672131025 1372105 1940449 1393 = 7 x 199
 ... ...
 ...
 ...
 ...

How do I find square triangular numbers?


Well, you could copy them from the Wikipedia page! But if you want to find them yourself, you will soon encounter some interesting mathematical theory:

If s2 = t(t+1)/2, and we introduce X=2t+1, Y=s, then this rearranges to an example of Pell's equation:

     X2 - 8 Y2 = 1. 

There's a well-known way to solve Pell's equation using continued fractions, but essentially we find that


for some n.  Write (Xn, Yn) for the nth solution, so Xn+1 + Yn+1 sqrt(8) = (Xn + Yn sqrt(8)).(3 + sqrt(8)), which gives a recurrence relation for the solutions, which, in terms of the original (sn, tn), is:

tn+1 = 3tn + 4sn + 1
sn+1 = 2tn + 3sn + 1

Since x1 = 1, y1 = 1, we can get all the solutions easily.