Consider a 3 × 3 square, where each 1 × 1 square is filled with one of the integers from 1 to 13. A square is called mystical if each row sums to a multiple of 13, each column sums to a multiple of 13 and each of the two main diagonals sums to a multiple of 13. How many mystical squares are there?
Details and assumptions
Numbers in the square are not necessarily distinct.
2 mystical squares are considered different if they differ in any entry. In particular, rotations are (generally) considered distinct.
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.
impressive
Let's name the elements of our mystical square as a,b,c,d,f,g,h,i with a b c being the first row, d e f the second and g h i the third. It gets cumbersome to try put values in the square to meet the required condition so we should find some relation among the variables of the square to get an easy approach to the problem. Note that a + e + i = 1 3 q which gives i = 1 3 q − e − a and similarly from b + e + h = 1 3 p we get h = 1 3 p − b − e and we can also obtain g = 1 3 r − e − c
adding these three equations,
g + h + i = 1 3 ( p + q + r ) − ( a + b + c ) − 3 e
Note that the terms
g
+
h
+
i
and
a
+
b
+
c
are also multiples of 13
which means that
1 3 s = 1 3 ( p + q + r ) − 1 3 t − 3 e
⇒ 3 e = 1 3 ( p + q + r − s − t )
Therefore, 1 3 ∣ e which means that e = 1 3 because e can only take value between 1 and 13 .
So, putting e = 1 3 in our previous equations we get
g = 1 3 − c
h = 1 3 − b
i = 1 3 − a
similarly the other two remaining quantities d & f can be written in terms of a,b & c . Therefore, to every value of ordered triplet of (a,b,c) , we get unique values of d,f,g,h & i and hence a unique mystical square. So, the no. of mystical squares is in one-one correspondence with the no. of ordered triplets (a,b,c) satisfying
a + b + c = 1 3 z where, clearly, z can take values 1,2 & 3 . so putting these values of z one by one in the above equation, we can get the required no. of ordered triplets by using the technique of Generating Functions .
z=1 gives 66 ordered triplets z=2 gives 102 and z=3 gives 1 triplet .
Therefore the required answer is
6 6 + 1 0 2 + 1 = 1 6 9
excellent way..... just e is missing while taking the elements name int the first line
Log in to reply
Thanks :) And yes i noticed the missing 'e' just after submitting the solution.
Subtract 1 from all the numbers in the problem and you will get: "Fill squares with numbers from 0 to 12. All the 8 sums (rows, columns and main diagonals) add up to 1 0 ( m o d 1 3 ) .
Now choose a, b, c in the left-upper, centre and right-upper square respectively. This fixes all the other squares: the upper-middle square becomes − a − b ; the bottom row becomes 1 0 − b − c , a + b − c , 1 0 − a − c respectively. The middle row then becomes: b + c − a , c , a + c − b .
Checking all the 8 sums gives 6 times a value of 10 (mod 13), by construction; the two other sums give 3 c = 1 0 ( m o d 1 3 ) or (times 9): c = 1 2 ( m o d 1 3 ) .
So all solutions must have a center square containing 12 and both corner cells in the top row can have any number, giving 13x13 possibilities.
Stated in original terms: the center square must contain the number ( 1 2 m o d 1 3 ) + 1 = 1 3 and all the 8 sums add up to ( 1 0 m o d 1 3 ) + 3 and are thus a multiple of 13. There are 1 3 x 1 3 = 1 6 9 possibilities. QED.
Denote the ith row and the jth column by (i,j). (1,1)+(2,2)+(3,3), (2,1)+(2,2)+(2,3) and (3,1)+(2,2)+(1,3) are divisible by 13. Their sum, (1,1)+(2,1)+(3,1)+(1,3)+(2,3)+(3,3)+3(2,2) is also divisible by 13. Since (1,1)+(2,1)+(3,1) and (1,3)+(2,3)+(3,3) are both divisible by 13, 3(2,2) is divisible by 13. Since gcd(3,13)=1, (2,2) is divisible by 13 and (2,2)=13 [1<=(2,2)<=13]. Note that each value of (1,1) and (3,1) determines a unique mystical square. [This needs some explanation. While it's clear that the entires will be uniquely determined, it is not immediately obvious that what results is a mystical square - Calvin] There is a bijection from the value of (1,1) and (3,1) to the mystical square. Since there are 13 possible values for (1,1) and 13 possible values for (3,1), there are 13*13=169 mystical squares.
Problem Loading...
Note Loading...
Set Loading...
First off, note that we can cast the problem into modulo 1 3 language: the integers to choose from are representatives of the 1 3 congruence classes, one of each. All rows, columns and diagonals should add up to zero (modulo 1 3 ).
Now consider the sum of all the rows - this is in effect the sum of all the entries. Since each row independently should add up to zero, the total sum should too.
Next, consider the sum of the two diagonals, the center row and the center column, all together. This again must be zero. Note that this sum again involves all entries, but the entry in the center square is now counted four times instead of once. So, when we take the difference of this sum with the previous sum, we conclude that the center entry, multiplied by 3 ( = 4 − 1 ), must be zero. Therefore, since 3 and 1 3 are coprime, the entry itself must be zero (i.e. 1 3 ).
Now let us put two numbers a and b in the top corner squares. The other squares are then fixed:
a b − a − b − a − b 0 a + b b a − b − a
It is easy to verify that this satisfies all constraints. Therefore, for every choice of a and b , there is exactly one solution (remember that we have exactly one representative of each congruence class). The answer is thus the number of ways in which a and b can be chosen, which is 1 3 2 = 1 6 9
Finally, let us consider what happens when 1 3 is replaced with n . The only property of 1 3 that we used, is that it is coprime with 3 . Therefore, similarly, if n is not divisible by 3 , the answer is n 2 .
If n is divisible by 3 , the center square could also contain n / 3 or 2 n / 3 . In each case, we could apply the same argument and make a similar matrix with a 's and b 's, but it is also sufficient to notice that adding n / 3 or 2 n / 3 to all elements of a solution gives another one. This gives a one-to-one-to-one relation between the solutions featuring either zero, n / 3 or 2 n / 3 in the center. The answer thus becomes 3 n 2 in this case.