# Sums of integers are squares

How can I find the set of distinct positive integers $\mathbb S=\{a, b, c, d, e, f, g, h, i\}$ such that:

1. $a+b$, $b+c$, $a+c$ are squares,
2. $d+e$, $e+f$, $d+f$ are squares,
3. $g+h$, $h+i$, $g+i$ are squares,
4. $a+b+c = d+e+f = g+h+i$ is square?

If there are several solutions then choose with minimal $a+b+c$.

-
Do you want the integers to be distinct? Otherwise you can dispense with conditions 2 and 3 and most of 4; if 1 is satisfied and $a+b+c$ is a square, you can take $(a,b,c) = (d,e,f) = (g,h,i)$ and satisfy the other conditions for free. – MJD Apr 5 '12 at 19:06
@MarkDominus, edited: yes, I want them to be distinct. – eigenein Apr 5 '12 at 19:08

A computer search gives $a=97$, $b=192$, $c=2112$; $d=720$, $e=801$, $f=880$; and $g=376$, $h=465$, $i=1560$.

-
a far simpler solution than mine!! – Ronald Apr 5 '12 at 20:37
Well I used the computer instead of thinking, so it was easy! – Byron Schmuland Apr 5 '12 at 20:43
This obviously yields the related solution 9700 + 19200 + 211200 = 72000 + 80100 + 88000 = 37600 + 46500 + 15600 = $490^2$. But curiously, there is another solution with $9700 + a + b = 490^2$, namely $9700 + 165024 + 65376 = 490^2$, and in fact we can do even better for $490^2$; there are at least 8 pairwise distinct solutions: 9700 + 165024 + 65376 = 26656 + 161700 + 51744 = 19200 + 160576 + 60324 = 37600 + 156000 + 46500 = 30336 + 121764 + 88000 = 55200 + 116196 + 68704 = 44736 + 110500 + 84864 = 72000 + 88000 + 80100 = $490^2$. – MJD Apr 5 '12 at 21:21

You can find 'triples' a, b, and c by taking any three square numbers, e.g. ${1, 4, 9}$ and then solving for a, b and c simultaneously, such that: $a+b = 1, a+c=4, b+c=9$

In this case: $a=-2, b=3, c=6$

This case actually doesn't work because $a = -2$ but nonetheless this gives you a general method. If your chosen three numbers are sufficiently far away from 0 (close to each other), negative numbers shouldn't be a problem. In fact, to avoid negatives, I think we need to choose three squares which satisfy the triangle inequality, that the sum of the two smaller squares is bigger than the largest square.

Now note that $2(a+b+c) = (1+4+9)$ So, then you need to find three sets of squares that sum to the same square number, to give your three sets. The big square also has to be even, or you'll get non-integer results. You also have to ensure that you get integer results :S

The 'minimal (a+b+c)' condition is covered by choosing the smallest square number that has this property, so we can stop when we find one solution.

So, we need the smallest even square that can be split into three distinct squares, in three distinct ways, where each way satisfies the triangle inequality!

I was hoping for help from The Encyclopedia of Integer Sequences but it only partially covers that situation, at https://oeis.org/A024803, and not well enough to find a suitable square by hand :(

-

The equation $x^2+y^2+z^2=2w^2$ has infinitely many solutions. For example, one family is

$x=3m^2+2mn-n^2$

$y=3m^2-2mn-n^2$

$z=4mn$

$w=3m^2+n^2$

-

Partial table of results (sorted by $\sqrt{a+b+c}$) :

$\small \begin{array} {r|lllllll} 49&[97, 192, 2112] & [376, 465, 1560] & [720, 801, 880]\\ 71&[*280, 945, 3816] & [*280, 1320, 3441] & [417, 1792, 2832]\\ 79&[312, *1057, 4872] & [616, 2520, 3105] & [*1057, 1752, 3432]\\ 85&[336, 1600, 5289] & [*2041, 2184, 3000] & [984, *2041, 4200]\\ 87&[344, *680, 6545]& [513, 1008, 6048]& [*1169, 1640, 4760]& [*680, *1169, 5720]\\ 91&[360, 3240, 4681]& [1392, 3097, 3792]& [1720, 2505, 4056]\\ 95&[561, 2464, 6000]& [744, 1281, 7000]& [2136, 2625, 4264]\\ 97&[193, 1488, 7728]& [*1128, 2353, 5928]& [*1128, 3633, 4648]\\ 98&[388, 768, 8448]& [1504, 1860, 6240]& [2880, 3204, 3520]\\ 103&[808, *2328, 7473] &[1584, 3040, 5985]& [2688, 3553, 4368]& [1393, *2328, 6888]\\ 105&[1224, 2376, 7425] &[209, *2000, 8816] &[416, *4625, 5984] &[*824, 3800, 6401]& [1616, *4625, 4784]& [*824, *1025, 9176]&[*1025, *2000, 8000]\\ 111&[1296, 5265, 5760]& [1712, 2912, 7697]& [2520, 3105, 6696]\\ 113&[225, 3744, 8800]& [448, 1953, 10368]& [1320, 4305, 7144]& [2568, 4488, 5713]& [2769, 4120, 5880]\\ 115&[*681, 1344, 11200]& [2200, 4200, 6825]& [*681, 4944, 7600]\\ 117&[233, 3488, 9968]& [1145, *3080, 9464]& [*2240, 3689, 7760]& [*3080, 4664, 5945]&[464, *2240, 10985]\\ 119&[472, 6417, 7272]& [*2280, 3345, 8536] &[*2280, 4945, 6936]\\ 121&[480, 3616, 10545]& [*1185, 1416, 12040]& [*1185, 4440, 9016]\\ 123&[2360, 6104, 6665]& [1904, 2585, 10640]& [3465, 4104, 7560]\\ 125&[249, 6976, 8400]& [*1225, 5016, 9384]& [4176, 5625, 5824] &[4600, 4809, 6216]&[984, *1225, 13416]\\ 127&[504, 4680, 10945]& [1968, 3808, 10353]& [3360, 5104, 7665]\\ 129&[512, 7232, 8897]& [1016, 4760, 10865]& [2241, 4320, 10080]\\ 131&[1785, 6136, 9240] &[*2032, 5712, 9417]& [3936, 5280, 7945]&[777, *2032, 14352]\\ 133&[1048, 6873, 9768]& [2313, 7488, 7888]& [4000, 4464, 9225]\\ 135&[*536, 1064, 16625]& [*2600, 5681, 9944]& [*536, *2600, 15089]\\ 137&[273, 2128, 16368]& [*1345, 3144, 14280]& [*1345, 5544, 11880]\\ 141&[3497, 7112, 9272]& [*281, 560, 19040]& [1656, 7560, 10665]& [2457, 6192, 11232]& [2720, 4505, 12656]& [*281, 8000, 11600]\\ \end{array}$

-
curiously although 49 is a valid solution (listed above by Byron), 71, 79, 85 do not form a set of distinct numbers. – Ronald Apr 5 '12 at 21:14
@Ronald: Thanks for the observation Ronald! I didn't verify unicity in my computer search and found such solutions of interest too. Anyway I'll update my table and try to indicate the duplicate numbers. – Raymond Manzoni Apr 5 '12 at 21:36

I used essentially the same strategy as @ronald: Let $(I, J, K)$ be perfect squares, and then if $I+J+K\over 2$ is also a perfect square, we have found a triple $(a,b,c) = ({I+J-K\over 2}, {J+K-I\over 2}, {K+I-J\over 2})$ that satisfies the conditions. We accumulate many such $(I,J,K)$ triples and see if the $I+J+K\over 2$ values match. Often, they do. When we find three or more matching sets, we have solved the problem.

Please excuse my Perl code:

my @sq = map $_ *$_, (1..1000);
my %sq2 = map { ($_ * 2 => 1) } @sq; for my$i (0 .. $#sq) { my$I = $sq[$i];
print STDERR "# $i...\n"; for my$j ($i+1 ..$#sq) {
my $J =$sq[$j]; for my$k ($j+1 ..$#sq) {
my $K =$sq[$k]; next if$I+$J <=$K || $J+$K <= $I ||$K+$I <=$J;
if ($sq2{$I+$J+$K}) {
my ($a,$b, $c) = (($I+$J-$K)/2, ($J+$K-$I)/2, ($K+$I-$J)/2);
my $z = ($I+$J+$K)/2;
push @{$SOL{$z}}, [$a,$b, $c]; if (@{$SOL{$z}} > 2) { for my$trip (@{$SOL{$z}}) {
print join(" + ", @$trip), " =$z\n";
}
print "\n";
}
}
}
}
}


Solutions are abundant. For example, all of the following add up to $901^2$:

1801 + 722400 + 87600
8985 + 488040 + 314776
14352 + 606592 + 190857
17920 + 679305 + 114576
21480 + 440920 + 349401
23257 + 694152 + 94392
25032 + 564792 + 221977
39160 + 515865 + 256776
44425 + 721200 + 46176
49672 + 423672 + 338457
63576 + 682920 + 65305
70480 + 577545 + 163776
70480 + 667401 + 73920
97776 + 601120 + 112905
99465 + 426160 + 286176
99465 + 485760 + 226576
101152 + 494832 + 215817
106201 + 413640 + 291960
107880 + 432345 + 271576
112905 + 519120 + 179776
117912 + 471912 + 221977
134472 + 533017 + 144312
141040 + 492576 + 178185
182952 + 360217 + 268632
192432 + 365577 + 253792
197145 + 403480 + 211176


Addendum: I should explain how I came up with this strategy so that it doesn't seem like I pulled it out of nowhere. I first tinkered around with various sums and products of $a+b$, $a+c$, and $b+c$ looking for something that seemed promising. All three of these sums are squares, and if you add them all together, you get $2a+2b+2c$, which must be twice a square. So I knew I was looking for three squares that added up to twice a fourth square, and searching over squares is faster than searching over integers. So I let $(I, J, K) = (a+b, a+c, b+c)$ and did the search on $(I, J, K)$ instead of on $(a,b,c)$. I think there's some general principle at work here about looking for lost wallets under lampposts but I'm not quite sure what it is.

-
That's what I did too. – Byron Schmuland Apr 5 '12 at 21:18