# Add a number to each vertex of a triangle such that each edge adds to a perfect square

Suppose you have a triangle with a place to put a number on each of the three vertices.

What unique numbers can go in each of the three vertices such that the numbers on each edge add to a perfect square?

• Huh? What circles? – Hackiisan Sep 6 '15 at 6:22
• Please add more information. How many circles are you trying to fill? Is it just 3? Are you really just looking for any 3 numbers that add up to a square number? If so, 1, 2 and 6 will do it! – Gordon K Sep 6 '15 at 6:26
• It looks like the question relates to a picture, but that it is missing in the post. – Florian F Sep 6 '15 at 9:20
• Pick any three perfect squares $a$, $b$, and $c$ of your choice. Then, $\frac{a+b-c}{2}$, $\frac{a-b+c}{2}$, and $\frac{-a+b+c}{2}$ are three numbers you could put on the vertices of the triangle. – Joe Z. Sep 11 '15 at 1:26

There are an infinite combinations of such numbers. A few processes for finding these are described below.

Here is a process for finding a triple of these numbers from two perfect squares. Pick two squares, $a$ and $b$, such that $a$ is even. Then, put $a/2$ on two vertices of the triangle, and $b-(a/2)$ on the third vertex.

Therefore, there are three combinations:

• $a/2 + a/2 = a$, which is a perfect square, and
• $(b-(a/2))+a/2 = b$, occuring twice, which is a perfect square.

Thus, you can pick any two squares, and as long as one of them is even, you can find three numbers that go on the vertices of the triangle.

A quick bit of Haskell to find all triples is (with isSquare as a function returning true/false depending on whether the input is a square):

[(a, b, c) | a <- [1..50], b <- [1..a], c <- [1..b], isSquare (a+b), isSquare (b+c), isSquare (a+c)]


Or, alternately (leaving off casting for clarity):

[(a/2, a/2, b-(a/2)) | a <- [1..50], b <- [1..a], isSquare a, isSquare b]


It is not, however, the case that all combinations are generated in this way. To show this, if we run:

[(a, b, c) | a <- [1..50], b <- [1..a], c <- [1..b], isSquare (a+b), isSquare (b+c), isSquare (a+c), a /= b, a /= c, b /= c]


we then get the output:

[(30, 19, 6), (44, 20, 5), (47, 34, 2), (48, 33, 16)]


which are the first four triples of unique numbers satisfying the perfect-square condition.

$-1.5, 5.5, 10.5$. If you add these three numbers then it is also correct