Squares In Arithmetic Progression


Study the following sets of numbers –

1)    1    25    49

2)    4    100    196

Each set has three numbers and each number is a perfect square. Further, the three numbers are in Arithmetic Progression (AP). In the first set, the common difference is 24 and in the second set, it is 96.

Question is, how many such sets are there and how many can you find?


Lot of material is available in the cyberspace on this topic. There are infinite sets with above properties. It is also shown by theoreticians that a maximum of three squares can be in AP, not four or more.

Purpose of this paper is not to delve into detailed theory and methods of working out solutions. The attempt here is to work out as many solutions as possible. To this end, a computer program is written for working out ALL solutions upto a limit.

In the above sets, I have labeled the squares as A2, B2 and C2 respectively. These are squares of integers A, B and C. For set (1), A = 1, B = 5 and C = 7 and for set (2), A = 2, B = 10 and C = 14. The smallest number in the set is A and the largest one is C.

Largest integer that can be stored in computer memory of four bytes is 231 – 1 = 2,147,483,647. This sets a limit on the largest square C2. This number C2 cannot be larger than the above 10 digit number and hence, the number C cannot be larger than 46,340. This is the limit set in the computer program.

The program logic is very simple. A is made to vary from 1 to 46,338 and C varies from 3 to 46,340. It was seen that there are lot many solutions. Therefore, A was varied over a small range of 1,000. Hence, the program was run several times. Total 47,063 solutions were obtained. It is not possible to give all solutions here. As a sample, first 617 and last 213 solutions are given in the file SQRAP.

The first 617 solutions correspond with values of A from 1 to 100. The last 213 values correspond with values of A from 29,001 to 46,340. For obvious reasons, A does not reach 46,340. In fact, the largest value of A (in the given range below 46,340) for which a solution exists is 32,398. Hindsight indicates that value of A could have been varied with an upper limit of say, 32,400.