Are there arbitrarily large sets $\mathcal S=\{a_1,\ldots,a_n\}$ of strictly positive integers such that all sums $a_i+a_j$ of two distinct elements in $\mathcal S$ are squares?

Considering subsets in $\mathbb Z$ should essentially give the same answer since such a set can contain at most one negative integer.

An example of size $3$ is given by $\{6,19,30\}$. (Allowing $0$, one gets $\{0,a^2,b^2\}$ in bijection with Pythagorean triplets $c^2=a^2+b^2$.)

There is no such example with four integers in $\{1,\ldots,1000\}$. (Accepting $0$, solutions are given by Euler bricks: $\{0,44^2,117^2,240^2\}$ is the smallest example. I suspect thus that there are strictly positive solutions in $\mathbb N^4$).

An equivalent reformulation: Consider the infinite graph with vertices $1,2,3,\ldots$ and edges $\{i,j\}$ if $i+j$ is a square. Does this graph contain arbitrarily large complete subgraphs? (Trivial observation: Every edge $\{a,b\}$ is only contained in finitely many different complete subgraphs.)

Motivation This is somehow a variation on question Generalisation of this circular arrangement of numbers from $1$ to $32$ with two adjacent numbers being perfect squares

  • 1
    $\begingroup$ Obviously, there are lots of triples: Let $b_1$, $b_2$, $b_3$ be three positive integers such that the sum is even and so that $2b_i^2<b_1^1+b_2^2+b_3^2$ for $i=1,2,3$. Then set $$(a_1,a_2,a_3) = \tfrac12(-b_1^2+b_2^2+b_3^2,\ b_1^2-b_2^2+b_3^2,\ b_1^2+b_2^2-b_3^2).$$ $\endgroup$ Nov 11, 2021 at 21:36
  • $\begingroup$ Indeed, and they are obviously all of this form. $\endgroup$ Nov 11, 2021 at 21:51

3 Answers 3


The size of such sets is bounded by some (unknown) constant, assuming a big conjecture in arithmetic geometry.

The Bombieri-Lang conjecture (non-trivially via the Uniformity Conjecture, see Stanley Yao Xiao's comment) implies that for any $f(x)\in \mathbb{Z}[x]$ of degree $5$, with no repeated roots, there are at most $B$ many rational numbers $m$ for which $f(m)$ is a square - here $B$ is some absolute constant (so the conjecture goes), completely independent of $f$.

This implies that the size of a set $A$ such that $a+a'$ is a square for any two distinct elements $a,a'\in A$ is at most $B+5$. Indeed, take any $5$ distinct elements $a_1,\ldots,a_5\in A$, and consider $f(x) = (x+a_1)\cdots(x+a_5)$. For any $m\in A\backslash \{a_1,\ldots,a_5\}$, we know that $f(m)$ is a square, and so $\lvert A\rvert-5\leq B$.

I learnt of this kind of argument (and the Uniformity Conjecture) via this paper of Cilleruelo and Granville, which has many similar arguments and applications: https://arxiv.org/pdf/math/0608109.pdf.


"D15 Numbers whose sums in pairs make squares" in Guy, Unsolved Problems in Number Theory, 3rd ed., credits Erdos and Leo Moser with asking "are there, for every $n$, $n$ distinct numbers such that the sum of any pair is a square?" Guy gives formulas for $n=3$ and $n=4$, and references to two papers of Lagrange (Jean, not Joseph-Louis): Cinq nombres dont les sommes deux à deux sont des carrés, Séminaire Delange-Pisot-Poitou (Théorie des nombres) 12^e année, 20 (1970-71) 10pp, and Six entiers dont les sommes deux à deux sont des carrés, Acta Arith. 40 (1981) 91-96.

The six integers Lagrange found are given by Guy as $$-15863902\qquad17798783\qquad21126338\qquad49064546\qquad82221218\qquad447422978$$

The section contains some related questions and references to the literature.

  • $\begingroup$ The question seems to require strictly positive numbers. Are there examples known for n = 6? $\endgroup$
    – Simd
    Nov 12, 2021 at 11:44
  • $\begingroup$ @Anush, none are given by Guy, and I don't know whether any have since been found. He does give a strictly positive example for $n=5$. $\endgroup$ Nov 12, 2021 at 21:42
  • 1
    $\begingroup$ There is some more information at oeis.org/A195854 $\endgroup$ Nov 12, 2021 at 21:48
  • $\begingroup$ In paper A. Choudhry, Sextuples of integers whose sums in pairs are squares, Int. J. Number Theory 11 (2015), no. 2, 543–555. five examples of six distinct integers are given, but they also contain one negative number. $\endgroup$
    – duje
    Nov 13, 2021 at 7:06

This is more of a comment than an answer. This problem has been considered by many, but the problem is that the solution is reduced to solving a system of Diophantine equations of the 2nd degree. Even in some special cases, the solutions are quite complex and cumbersome.

As the number of unknowns increases, the number of equations that need to be solved faster than the number of unknowns in them increases. And the complexity in the solution and parametrization increases very quickly. If for 3 unknowns, you can write a simple parameterization... even for a more complex system.



Then for 4 unknowns it is quite a difficult task and parameterization looks cumbersome.


In this topic there is a link to the article how Euler solved this system for 4 unknowns.


Generally speaking. It is extremely difficult to find parametrizations of systems of Diophantine equations. That's probably why this is the most ignored direction in research. Diophantus dedicated his book to the system of equations... but no one mentions it.

  • 3
    $\begingroup$ In fact, in Book V of Arithmetics written by Diophantus, in Exercise 9, we can find three rationals, and after scaling three integers with given property: 4843, 5358, 61206. $\endgroup$
    – duje
    Nov 13, 2021 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.