All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
A square of squares (Posted on 2022-11-25) Difficulty: 3 of 5
For a long time there was an attempt to create an elusive 3x3 square of integers meeting two criteria:
a. all integers should be distinct squares.
b.They should add to the same value along all rows, columns and diagonals.

Apparently, no one succeeded to create such a magic square. The closest to the above goal was a set of 3 distinct squares and 3 couples of identical square numbers like a, b, c, d, d, e, e, f & f. Each of the 3 rows, 3 columns and one diagonal sum up to the same value - the other diagonal does not.

Find such solution, keeping in mind that all the numbers are odd and the sum is a 4-digit number.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution Comment 2 of 2 |
I found two different solutions (not counting reflections and rotations).  These were already found by Steven Lord.

Both solutions use the squares of the same six odd integers, but in one solution one subset of three integers appears twice, whereas in second solution it is the opposite subset of three which appears twice.

The magic sum for the first is 3051.
The magic sum for the second is 3579.

The first solution includes the squares of:
{1, 1, 23, 29, 29, 37, 41, 41, 47}
In this example the diagonal with the correct sum is upper left to lower right.
Example:
841 1 2209
1681 1369 1
529 1681 841

---
The second solution uses the squares of:
{1,  23, 23, 29, 37, 37, 41, 47, 47}
In this example the diagonal with the correct sum is lower left to upper right.
Example:
1 2209 1369
2209 841 529
1369 529 1681

Notes on algorithm.
I wanted to do a sequence of manipulations to decrease the number of possibilities rather than do a brute force search, interested in the quest more than the actual solution.
I started with a list of the first 50 odd squares.
I then made a large list of all sets of 3 of these that would add up to a 4-digit number, but always a <= b <= c

Then I made a dictionary where each key would be a 4-digit number which was one of the sums of 3 squares; and the value for that key was a list of lists which included any 3 squares which added to that same sum.

Next, I parsed through the dictionary: for each key (sum) there were however many triplets which added to that sum.  I went through the combination of that many triplets taken 3 at a time and saved only those groups of 3 triplets which conformed to the correct pattern of a,b,c,d,d,e,e,f,f.  The length of the set had to be 6 (ignores duplicates) and also the maximum count of any element had to be 2.
There were only 2862 of these 3 sets of triplets.

The next step was to consider a triplet as a row (though the order within that row might need to be shuffled).  Three correct column sums and one correct diagonal sum means there must be at least 4 combinations of picking one from each row and getting the same sum.  My method of picking the "rows" had already assured 3 correct row sums.

There were only 3 possible solutions after this final screening, two of which I have shown above.  I manually moved the elements around until I found the "almost magic" square.
The 3rd possible solution turned out not to have a proper solution:  I could only get 3 rows, 1 column and 1 diagonal.  This was a kind of "false positive" in that there were enough winning combinations only because two of the three sets of "doubles" showed up in the same triple, where as for the two valid solutions, each member of a pair was in a different triplet
For reference, this one had a row sum of 2643
 and included the squares of:
{1, 11, 11, 29, 29, 31, 31, 41, 49} (no valid solution)
([1, 961, 1681], [121, 121, 2401], [841, 841, 961])

Contrast with the "winning" sets:
([1, 841, 2209], [1, 1369, 1681], [529, 841, 1681])   and
([1, 1369, 2209], [529, 841, 2209], [529, 1369, 1681])


  Posted by Larry on 2022-11-29 23:05:45
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information