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

Home > Numbers
Squares in a 4x4 Grid (Posted on 2023-07-21) Difficulty: 3 of 5
Leilani placed a digit in each of these 16 squares:
+------+------+------+------+
|      |      |      |      |      
+---- -+------+------+------+
|      |      |      |      |     
+------+------+------+------+
|      |      |      |      |     
+------+------+------+------+
|      |      |      |      |      
+------+------+------+------+

When she had finished, the grid had the following properties:

• No digit occured more than once in any row.
• The sum of the four digits in each row was the same.
• The sum of the four digits in each column was the same.
• Each row formed a different four-digit perfect square.

Complete the 4x4 square grid given above.

Note: Adapted from Enigma #1553 which appeared in 'New Scientist' in 2009.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 3 of 6 |
clearvars,clc 
for i=32:99
  sq(i,:)=char(string(i^2));
  sm(i,:)=sum(sq(i,:)-'0');
end
[sums, idx]=sort(sm);
squares=sq(idx,:);
for i=1:length(sums)
  fprintf('%s %5d\n',squares(i,:),sums(i))
end
for htot=7:25
  idx=find(sums==htot);
  if length(idx)>=4
    sourceSq=squares(idx,:);
    combins=combinator(length(sourceSq),4,'c');
    for i=1:size(combins,1)
      grid=sourceSq(combins(i,:),:);
      good=true;
      for col=1:4
        s=sum(grid(:,col)-'0');
        if col>1 && s~=prev 
          good=false;
          break;
        end
        prev=s;
      end
      if good
        disp(grid)
        disp(' ')
      end
    end

  end
end

find first the 4-digit squares ordered by their sod's:

1024     7
1600     7
2401     7
2500     7
1521     9
2025     9
2304     9
2601     9
3600     9
8100     9
1225    10
2116    10
3025    10
5041    10
6400    10
1156    13
1444    13
2209    13
2704    13
3136    13
3721    13
4225    13
4900    13
6241    13
1681    16
3364    16
3481    16
4624    16
7225    16
9025    16
1089    18
1296    18
1764    18
2916    18
3249    18
4356    18
4761    18
5184    18
5625    18
6084    18
6561    18
7056    18
9216    18
9801    18
1369    19
1936    19
2809    19
3844    19
4096    19
5329    19
6724    19
7921    19
8281    19
9604    19
1849    22
5476    22
7744    22
8464    22
9409    22
4489    25
5776    25
5929    25
7396    25
8836    25
3969    27
7569    27
8649    27
6889    31

and then searches the successive sod's for sets of four which satisfy the equal-column-total requirement, and finds

1764
3249
5184
9801

As is necessary, the equal column sums match the equal row sums.

  Posted by Charlie on 2023-07-21 10:32:19
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 (9)
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