Fill the Squares

Fill the empty squares with integers from 1 to 9, using each integer exactly once, to get the given results. Calculations are done from left to right, and from top to bottom.

What is the sum of the sums of numbers on the 2 diagonals?

Note that the center square is added twice.

32 23 27 19

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

6 solutions

Manojkumar P
May 7, 2016
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import itertools
l=[1,2,3,4,5,6,7,8,9]
for x in itertools.permutations(l,9):
  a=x[0]+x[1]-x[2]
  b=x[3]*x[4]-x[5]
  c=x[6]*x[7]-x[8]
  d=x[0]-x[3]-x[6]
  e=x[1]+x[4]*x[7]
  f=x[2]+x[5]-x[8]
  if(a==3 and b==29 and c==-1 and d==-5 and e==9 and f==12):
    break
d1=x[0]+x[4]+x[8]
d2=x[2]+x[4]+x[6]
print(d1+d2)

Python brute-force. Cool.

Antonio Skara - 5 years ago

Ayy lmao, I thought this wasnt allowed here...

Satdhruti Paul - 4 years, 5 months ago
Antonio Fanari
Sep 16, 2014

a(j,j) ∈ {1,2,3,4,5,6,7,8,9}; i,j ∈ {1,2,3}

it's convenient to start from multiplications and large total resultates;

  • row 2: a(2.1)xa(2,2) – a(2,3) = 29;

  • col. 2: a(1,2) + a(2,2)xa(3,2) = 9;

the possible triplets for row 2 are (9,4,7), (4,9,7);

but eq. for col 2 implies a(2,2) = 4; so: a(2,1) = 9; a(2,3) = 7;

  • col. 2: a(1,2) + 4a(3,2) = 9; choice in {1,2,3,5,6,8};

the triplet that satisy eq. col. 2 is: (5,4,1);

  • row 3: a(3,1) – a(3,3) = -1; choice in {2,3,6,8};

the triplet that satisfy eq. row 3 is: (2,1,3), with:

a(3,1) = 2; a(3,2) = 1; a(3,3) = 3;

  • col. 1: a(1,1) – 9 – 2 = - 5; choice in {6,8};

the triplet that satisfy eq. col. 1, so that:

a(1,1) = 9 + 2 – 5 = 6, is: (6,9,2);

  • row 1: 6 + 5 + a(1,3) = 3;

  • col. 3: a(1,3) + 7 + 3 = 12;

choice of a(1,3) in {8}, and a(1,3) = 8 satisy eqs row 1 and col. 3;

Sd1 = a(1,1) + a(2,2) + a(3,3) = 6 + 4 + 3 = 13;

(sum of the elements of the first diagonal);

Sd2 = a(1,3) + a(2,2) + a(3,1) = 8 + 4 + 2 = 14;

(sum of the elements of the second diagonal);

so the total sum of the diagonal elements is Sdt:

Sdt = Sd1 + Sd2 = 13 + 14 = 27. \square


And the rows are: (6,5,8); (9,4,7); (2,1,3).

Couldn't row 2 also be 5,7,6 or 7,5,6 in the beggining when you have no other reliable information? How do you postulate it must be 4,9,7 or 9,7,4?

Thor Andreassen - 6 years, 8 months ago
Antonio Skara
Apr 12, 2015

As a reference to empty squares, I will mark them with $ sign and letters from " a " to " i " and call them cells; starting from first row; left to right. Also I will name given results (3, 29, -1, -5, 9, 12) with word "TOTAL"

We will start with second row, TOTAL=29 . For now; possible multiplications required to arrive to TOTAL=29 are 9x4 , 8x4 , 7x5 and 6x5 . Having in mind this factors we conclude that cell $e can only be one of these integers $e'={4, 5, 6, 7, 8, 9} .

We conclude that $d and $e ≠ 5 or 6 , because if $d = 5 , in first column we would need $a and $g to be |$a|=|$g| in order to arrive to TOTAL=-5 , and this is not allowed since we can't have „double integers“ in matrix. Also to assume $e = 5 , implicates $f and $h = 1 , so again we would have to have double integers, what leads us to conclusion that $e ≠ 5 . If $d and $e ≠ 5 , we cant have 5x6 multiplication in second row, so conlclusion is that $d and $e ≠ 5 or 6 .

We conclude that $h and $e ≠ 8 or 9 , because; in case of integer 8, we would have to have double integers in second column when arriving to TOTAL=9 , and in case of integer 9 we would not be able to arrive to mentioned TOTAL.

We conclude; since $d and $e ≠ 5 ; that:

1.) e$ ≠7 , because 7x5 multiplication therefore is not allowed;

2.) that only possible $e value is $e = 4 (from $e' we excluded integers 5, 6, 8, 9 earlier and now integer 7.).

Than we come to conclusion that $d = 8 or 9 .

Furthermore, in third column; to be able to arrive to TOTAL=12 respecting given operators; we must follow $f ≠ 1 or 2 or 3 .

Since $e = 4 , if $d would be $d = 8 , then $f would need to be $f = 3 in wich case we would not follow our $f ≠ 1 or 2 or 3 rule. So we conclude $d ≠ 8 and sequentialy $d = 9 .

Since $d=9 ; than $f is $f = 7 .

Also;

$h = 1 or 2 .

$g = 2 (all other integers excluded because they require use of double integers in matrix to arrive to TOTAL).

Then sequentialy we conclude that;

$h = 1 .

$b = 5 .

$a = 6 .

$c = 8 .

And finaly $i = 3 .

To sum it up we have:

6 5 8

9 4 7

2 1 3

good and easy solution using logical elimination rather than advanced maths .

Kislay prasoon - 4 years, 8 months ago
Guiseppi Butel
Sep 5, 2014

6,5,8: 9,4,7: 2,1,3

Did you figure that out by trial and error or did you use equations to get the answer?

Charles Davenport - 6 years, 9 months ago
Ir J
Jul 8, 2018

I know this isn't the most efficient solution, but just in case somebody is curious to the possible combination of numbers to be put in the box. haha.

Hadia Qadir
Jul 28, 2015

a(j,j) ∈ {1,2,3,4,5,6,7,8,9}; i,j ∈ {1,2,3} it's convenient to start from multiplications and large total resultates; row 2: a(2.1)xa(2,2) – a(2,3) = 29; col. 2: a(1,2) + a(2,2)xa(3,2) = 9; the possible triplets for row 2 are (9,4,7), (4,9,7); but eq. for col 2 implies a(2,2) = 4; so: a(2,1) = 9; a(2,3) = 7; col. 2: a(1,2) + 4a(3,2) = 9; choice in {1,2,3,5,6,8}; the triplet that satisy eq. col. 2 is: (5,4,1); row 3: a(3,1) – a(3,3) = -1; choice in {2,3,6,8}; the triplet that satisfy eq. row 3 is: (2,1,3), with: a(3,1) = 2; a(3,2) = 1; a(3,3) = 3; col. 1: a(1,1) – 9 – 2 = - 5; choice in {6,8}; the triplet that satisfy eq. col. 1, so that: a(1,1) = 9 + 2 – 5 = 6, is: (6,9,2); row 1: 6 + 5 + a(1,3) = 3; col. 3: a(1,3) + 7 + 3 = 12; choice of a(1,3) in {8}, and a(1,3) = 8 satisy eqs row 1 and col. 3; Sd1 = a(1,1) + a(2,2) + a(3,3) = 6 + 4 + 3 = 13; (sum of the elements of the first diagonal); Sd2 = a(1,3) + a(2,2) + a(3,1) = 8 + 4 + 2 = 14; (sum of the elements of the second diagonal); so the total sum of the diagonal elements is Sdt: Sdt = Sd1 + Sd2 = 13 + 14 = 27.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...