ThreeSquare by Elap
Puzzle explanation
When the corner cells are filled correctly, all rows and columns are triangular numbers.
The formula for the nth triangular number is T = n(n + 1)/2,
so n can be found when most of the digits of T are known,
as the next integer below √(2T).
NB: A primitive triangle is one where there is no factor common to all three sides,
meaning that it can’t be scaled down to a similar triangle with integer sides.
Two of the three sides may have a common factor, however.
Puzzle solution process
L2 and T2 are both less than 100, so L2 * T2 is less than 10000.
From the clue 33333 = L2 * T2 + r5, r5 must then start with 2 or 3.
From 333333 = E3 * P2 * j2, j2 is odd, so the first digit of P and r is odd;
thus r5 and P2 start with 3, and j2 ends with the same 3.
From 3333333 = P2 * X6 + W3, P2 can’t be greater than 33 because X6 has six digits, so P2 is 31 or 33.
From 333333 = E3 * P2 * j2, P2 has to be 33, because 31 isn’t a factor of 333333.
This leads to j2 = 13 (the only twodigit factor of 333333 / 33 that ends in 3)
and E3 = 777.
X6 is now between (3333333 − 999) / 33 and (3333333 − 100) / 33,
so it’s in the range 100980 to 101007; therefore X6 starts with 10 and X3 is 100 or 101.
From X3 * X3 = R2 + g4, where R2 and g4 have the same last digit,
X3 must be even, so X3 = 100 and X6 is 1009__.
R2 + g4 is now 10000. Their shared final digit can’t be 0 because it’s the first digit of S and t,
so it must be 5. Thus g4 is 99_5.
In the rightangled triangle E3, E3 − M3, V2 * X2 + Q3,
E3 = 777 can’t be the side corresponding to 2pq (using the information from the preamble),
so it must be p^{2} − q^{2} = (p + q)(p − q) = 777.
The other side, 2pq = E3 − M3, ends in 4 because E3 = 777 and M3 ends in 3.
The hypotenuse, p^{2} + q^{2} = V2 * X2 + Q3, ends in 5 because X2 = 10 and Q3 ends in 5.
The only possibilities for factorising 777 = 3 * 7 * 37 with (p − q) less than (p + q) are:
p − q  p + q  p  q 
3  259  131  128 
7  111  59  52 
21  37  29  8 
Of these, only the last gives a value of 2pq ending in 4, namely 2 * 29 * 8 = 464,
so E3 − M3 = 464, giving M3 = 313, and the hypotenuse is 905.
Using h2 * h2 = S3 + i2, we know S3 starts with 5, so S3 + i2 is in the range from 500 + 10 = 510 to 599 + 99 = 698.
This puts h2 in the range 23 to 26, making the first digit 2. Therefore D2 = 27.
In the rightangled triangle D2, s3, q3,
D2 = 27 must be the p^{2} − q^{2} side (being odd),
and s3 = 2pq and q3 = p^{2} + q^{2} both start with 3.
The only possibilities for factorising 27 are:
p − q  p + q  p  q 
1  27  14  13 
3  9  6  3 
Only the first of these has p and q relatively prime and gives threedigit values for the other sides,
namely s3 = 364 and q3 = 365.
For p3 * p3 = f3 + w5 we have _71 + 5____, which is in the range 171 + 50000 = 50171 to 971 + 59999 = 60970,
so p3 starts with 2, which makes L2 = 23.
For 3333333 = P2 * X6 + W3, we have 3333333 = 33 * 1009__ + __4, so X6 must end with a 3
and is therefore either 100983 with W3 = 894, or 100993 with W3 = 564.
For 33333 = L2 * T2 + r5 we have 33333 = 23 * 6_ + 3____; r5 therefore is from 33333 − 23 * 69 = 31746 to 33333 − 23 * 60 = 31953.
Since we know that the middle digit of W3 is either 6 or 9, r3 must be 319__,
which makes W3 = 894 and X6 = 100983.
For s3 * s3 = j6 + v3 with s3 = 364 and j6 = 13_9__,
j6 is from 132496 − 999 = 131497 to 132496 − 100 = 132396, so j6 must start with 1319.
Then from 333 = B3 + N2 + j3 with N2 = 13 and j3 = 131, we have B3 = 189.
For p3 * p3 = f3 + w5 we now have _71 + 58___, so p3^{2} is in the range 171 + 58000 = 58171 to 971 + 58999 = 59970,
which gives p3 = 242 to 244, so the second digit of p3 is 4.
For the rightangled triangle G2, Q2, k2, we know k2 is _3 = p^{2} + q^{2}.
All perfect squares end with 0, 1, 4, 5, 6 or 9;
a sum of two squares can end in 3 only if one of them ends with 4 and the other ends with 9.
The only possibility for a twodigit sum is 64 + 9, so we have p = 8 and q = 3,
giving k2 = 73 and the other sides (in some order) as p^{2} − q^{2} = 55 and 2pq = 48.
From e3 * e3 = F5 + Q3 we know that e3 is even (because F5 ends in 1 and Q3 ends in 5),
so G2 = 48 and Q2 = 55.
Then R2 = 55 and g4 = 9945, from X3 * X3 = R2 + g4.
For the hypotenuse X2 * V2 + Q3 we now have 10 * V2 + 555 = 905, so V2 = 35 and its first digit completes p3 = 243.
From e3 * e3 = Q3 + F5 with e3 = 124 and Q3 = 555, we now get F5 = 14821.
This makes b4 = _878, and we have W2 = 89, so from W2 * W2 = 7921 = b4 + u2 we get b4 = 7878 and u2 = 43.
For p3 * p3 = f3 + w5 we have 243^{2} = 59049 = _71 + 58___, so w5 is 58_78.
For h2 * h2 = S3 + i2 we have 24^{2} = 576 = 544 + i2, so i2 = 32.
For i2 * i2 = C3 + Q2 we now have 32^{2} = 1024 = __9 + 55, so C3 = 969.
For Z2 * Z2 = G2 + u4 we have Z2^{2} = 48 + 430_, so Z2 = 66 and u4 = 4308.
For the scalene triangle H2 + p3, h3 + n3, n3, m5, the sides are 17 + 243, 242 + 25_ and 25_,
ie, 260, 492 + x and 250 + x, where x is the last digit of n3.
Since m5, the area of the triangle, is the square root of s(s − a)(s − b)(s − c),
there must be an even number of each prime factor in this value.
The semiperimeter, s, is (260 + 492 + x + 250 + x) / 2 = 501 + x.
One of the values in the product is (s − n3), which is (501 + x) − (250 + x) = 251, a prime.
There must therefore be another 251 factor somewhere, ie, in one of
(501 + x), (501 + x) − 260 = 241 + x, or (501 + x) − (492 + x) = 9.
The last of these, 9, obviously doesn’t have a factor of 251 and,
since x is a single digit, 241 + x can’t either.
Therefore 501 + x must be divisible by 251, giving x = 1.
So, n3 = 251 and the area is m5 = 16566.
For s3 * s3 = j6 + v3 we now have 364^{2} = 132496 = 1319__ + 566, giving j6 = 131930.
For 33333 = L2 * T2 + r5 we then have 33333 = 23 * T2 + 31930, so T2 = 61.
For the rightangled triangle a2 + r2, e2 + m2, t2, the sides are a2 + 31, 12 + 16 = 28 and a hypotenuse of 5_.
If 28 is the p^{2} − q^{2} side, the only way to factorise 28 = (p + q)(p − q) so that p and q are positive integers
is with p + q = 14, p − q = 2, p = 8 and q = 6. This gives a hypotenuse of 100, which is wrong.
So 28 is the 2pq side, which makes p = 7 and q = 2, resulting in a triangle with sides 45, 28 and 53,
and making a2 = 14 and t2 = 53.
For 3333 = B3 * a2 + Y3, we 3333 = have 189 * 14 + Y3, so Y3 = 687.
For p3 * p3 = f3 + w5, we have 59049 = _71 + 58878, so f3 = 171.
For the scalene triangle U3, h2 + k2, j3 + v3, N4 + d5, the sides are 65_, 24 + 73 = 97 and 131 + 566 = 697.
Using x for the third digit of U3, the semiperimeter, s, is 722 + x / 2, so x must be even.
If the sides are a, b and c, we have five possibilities:
x  a  b  c  s  s − a  s − b  s − c 
0  650  97  697  722  72  625  25 
2  652  97  697  723  71  626  26 
4  654  97  697  724  70  627  27 
6  656  97  697  725  69  628  28 
8  658  97  697  726  68  629  29 
We need an even number of each prime factor in s(s − a)(s − b)(s − c).
For x = 2, there’s a factor of 71 in s − a only;
for x = 4, there’s a factor of 5 in s − a only;
for x = 6, there’s a factor of 23 in s − a only;
and for x = 8, there’s a factor of 29 in s − c only.
That leaves x = 0, where all the prime factors can be seen to pair off:
(2 * 19 * 19)(2 * 2 * 2 * 3 * 3)(5 * 5 * 5 * 5)(5 * 5),
and so we have U3 = 650.
The area is therefore 2 * 2 * 3 * 5 * 5 * 5 * 19 = 28500 = N4 + d5, so d5 = 27164.
For the scalene triangle J3 + x2, W2 + m2, p3 + x2, a5, the sides are
246 + 40 + x = 286 + x, 89 + 16 = 105 and 243 + 40 + x = 283 + x, where x is the second digit of x2.
Once again, looking at the semiperimeter, we have s = 337 + x.
Two of the terms of s(s − a)(s − b)(s − c) are therefore
(337 + x) − (286 + x) = 51 and (337 + x) − (283 + x) = 54.
The 51 term has a prime factor of 17, so there must be another factor of 17 in s = 337 + x or s – 105 = 232 + x.
Since x is in the range 0 to 9, it must be 3 or 6:
x  a  b  c  s  s − a  s − b  s − c 
3  105  289  286  340  235  51  54 
6  105  292  289  343  238  51  54 
For x = 3, the factor of 47 in 235 is unmatched, so x = 6, making x2 = 46.
The prime factors are (7 * 7 * 7)(2 * 7 * 17)(3 * 17)(2 * 3 * 3 * 3) and the area is 2 * 3 * 3 * 7 * 7 * 17 = 14994 = a5.
For the scalene triangle A3 + w2, B2 + c3, C3, K3 + q5, the sides are
_42 + 58 = 100x + 100, 18 + _63 = 100x + 81 and 969, where x is the first digit of A3 and c3.
The semiperimeter, s, is (100x + 100 + 100x + 81 + 969) / 2 = 100x + 575,
making s − a = 475, s − b = 494 and s − c = 100x − 394.
The area is K3 + q5 = 462 + 36588 = 37050, and so we have
37050^{2} = s(s − a)(s − b)(s − c) = (100x + 575) * 475 * 494 * (100x − 394),
which reduces to (100x + 575)(100x − 394) = 5850.
The first term is at least 575, so the second term can’t be more than 10 to make a product of 5850.
Therefore x is 4, giving A3 = 442 and c3 = 463.
For the scalene triangle G3 + L2, N3 + z2, y3, b4, the sides are
482 + 23 = 505, 133 + 7_ = 203 + x and 30_ = 300 + y,
where x is the second digit of z2 and y is the third digit of y3.
The area is 7878, which is 2 * 3 * 13 * 101.
We need an even number of the 101 factor in the product s(s − a)(s − b)(s − c).
The semiperimeter, s, is (505 + 203 + x + 300 + y) / 2 = 504 + x / 2 + y / 2,
and so the product is (504 + x / 2 + y / 2)(x / 2 + y / 2 − 1)(301 − x / 2 + y / 2)(204 + x / 2 − y / 2).
Two of these terms must have a factor of 101.
For the first term, 504 + x/2 + y/2, to have a factor of 101, x / 2 + y / 2 would have to be 1,
for which the (x, y) possibilities are (0, 2), (2, 0) or (1, 1),
but none of these results in another factor of 101 appearing in the other terms.
No singledigit values for x and y can make the second term a multiple of 101.
So it follows that 301 − x / 2 + y / 2 and 204 + x / 2 − y / 2 must both be divisible by 101,
ie, 303 and 202 respectively. This requires y / 2 − x / 2 = 2, so y = x + 4.
Since x and y are single digits, the only possibilities are these:
x  y  a  b  c  s  s − a  s − b  s − c 
0  4  505  203  304  506  1  303  202 
1  5  505  204  305  507  2  303  202 
2  6  505  205  306  508  3  303  202 
3  7  505  206  307  509  4  303  202 
4  8  505  207  308  510  5  303  202 
5  9  505  208  309  511  6  303  202 
As before, there must be an even number of each prime factor in s(s − a)(s − b)(s − c).
Looking at the values of s, it can readily be seen that x = 1 is the only case which satisfies this condition:
(3 * 13 * 13)(2)(3 * 101)(2 * 101).
We therefore have x = 1 and y = 5, producing z2 = 71 and y3 = 305, thus completing the clues.
All cells in the grid can thus be completed except for the shaded areas.
All complete rows and columns at this stage consist of triangular numbers,
ie, they have the form n(n + 1) / 2.
Solvers needed to fill the blank cells to ensure all rows and columns had this property.
