# Find a number to add to each of a set of numbers to make them all square?

You are given a set of integers $a_i$ ... $a_n$. Is there is a number $c$ such that $a_i+c$ ... $a_n+c$ are all square? Under what conditions does $c$ exist?

For example: a={0,12,21} has a solution c=4 because 0+4=4, 12+4=16, and 21+4=25 are all square. But a={0,1,2} has no solution because no three consecutive integers are squares.

For two numbers, this becomes "find two squares with a certain distance," but it doesn't extend to more than two numbers as far as I can see. For example, there's no solution for a={0,3,4} even though pairs of squares with distances 3, 4, and 1 exist. Unless I'm wrong, two squares with distance $d$ exist iff $d$ is odd or a multiple of 4.

This seems semi-related to Diophantine m-tuples, but I haven't found a way to use those results.

(This question came up when I was writing a program to find magic squares consisting of square numbers.)

\left\{\begin{aligned}&a+c=x^2\\&b+c=y^2\\&r+c=z^2\end{aligned}\right.

$$c=x^2-a$$

\left\{\begin{aligned}&b-a=kt=y^2-x^2=(y-x)(y+x)\\&r-a=qn=z^2-x^2=(z-x)(z+x)\end{aligned}\right.

\left\{\begin{aligned}&k=y-x\\&t=y+x\\&q=z-x\\&n=z+x\end{aligned}\right.

That is, reduced to a system of linear equations. As equations more than not known that the number of solutions for a specific set of course - if of course they exist.

\left\{\begin{aligned}&y=\frac{k+t}{2}\\&z=\frac{q+n}{2}\\&x=\frac{t-k}{2}=\frac{n-q}{2}\end{aligned}\right.

• Your left side of r+c is jarring. I think it would be easier if the left sides were a+r, b+r, c+r. Jun 20, 2017 at 13:30
• "As equations more than not known that the number of solutions for a specific set of course" I think I know what you're trying to say, but this sentence doesn't quite parse. Could you reword it? Jun 20, 2017 at 17:58
• @JohnGarvin I do not speak English. So Google translates. Jun 20, 2017 at 18:00