A Doku Square is an n × n array containing all integers from 0 to n − 1 exactly once in each column and each row. The entry in the i th row and j th column of Doku Square A is denoted by A i , j .
We call two n × n Doku Squares A and B friendly if all n 2 ordered pairs ( A i , j , B i , j ) are distinct.
What is the maximum number of 7 3 × 7 3 Doku Squares, such that any two of them are friendly?
This problem is shared by Sotiri K .
Details and assumptions
As an explicit example, the two squares 0 1 2 1 2 0 2 0 1 and 0 2 1 1 0 2 2 1 0
are 2 friendly 3 × 3 Doku squares.
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.
Great job!
In the literature, Friendly Doku squares are also known as Orthogonal Latin Squares.
Oh, your solution made my day :) Well done
I'm very much impressed by your proof! It's very clear and well structured. Thanks for the good read!
Nitpicking: there's an apostrophe missing in the 10th line of the proof of lemma 2 (it currently says j − j where it should say j ′ − j ).
Log in to reply
Thanks and you're very welcome! :) I had already written most of it for when I submitted the problem, but I added a lot of narration to make it clearer.
ARGHHHHHH stupid apostrophe! Oh well. Thanks for pointing it out. I also made another minor mistake in the second line of the third paragraph of the proof of lemma 1, where I said "members of M " rather than "members of N ". :P
Amazing solution. Really well done Sotiri :)
Log in to reply
Thanks! :) I'm glad you liked it and I hope you enjoyed the problem, too!
Log in to reply
I enjoyed it really much, although I was unable to provide a thorough proof as you did. Keep these coming! :)
Problem Loading...
Note Loading...
Set Loading...
Since there are still no solutions, I guess there's no harm in posting mine.
The solution boils down to answering two questions about Doku Squares (which will be referred to as DSs from now on). Firstly, is there an upper bound on the maximum number of n × n DSs that are pairwise-friendly, and secondly, if there is, which values of n (if any) actually achieve that upper bound?
The first question has a fairly simple answer.
Lemma 1 An upper bound on the number of n × n DSs that are pairwise-friendly is n − 1 .
Proof We note that taking any DS and permuting its elements (that is, taking every instance of i in the DS and replacing it with j and vice versa) will not change the fact that it is a DS. This means that we can make the first row of any DS be whatever we want it to be (by permuting multiple times), and from this point forward, we will call DSs that have their first row in increasing order "happy." That is, if A is a happy DS, then A 1 , 1 = 0 , A 1 , 2 = 1 , . . . , A 1 , n = n − 1 .
We also note that these permutations preserve friendliness. This is because if we have (for example) the ordered pairs ( a , a ) , ( a , b ) , ( a , c ) , ( b , a ) , ( b , b ) , ( b , c ) , ( c , a ) , ( c , b ) , ( c , c ) (which would be the ones generated by two friendly 3 × 3 DSs, applying a permutation such as a → c , c → a , b → b on one of them (say the first one) gives the ordered pairs ( c , a ) , ( c , b ) , ( c , c ) , ( b , a ) , ( b , b ) , ( b , c ) , ( a , a ) , ( a , b ) , ( a , c ) , which is clearly the same set of ordered pairs, and so the permuted first DS is still friendly with the original second DS. This is important because it tells us that if we have a set of n × n DSs which are pairwise-friendly, we can make each of them happy and be sure that they are still all pairwise-friendly.
Let N be a set of happy pairwise-friendly n × n DSs and let A , B be members of N . Looking at the first row of A and B , we find that ( A 1 , 1 , B 1 , 1 ) = ( 0 , 0 ) , . . . , ( A n , n , B n , n ) = ( n − 1 , n − 1 ) . Now let A 2 , 1 = a . a , of course, cannot be 0 , as 0 is already present in the first column of A . But now note that B 2 , 1 cannot be a , as the ordered pair ( a , a ) is already found by comparing the first rows of A and B . By extension, any two DSs in N must have distinct elements in the cell ( 2 , 1 ) , and this cell has n − 1 possible values 1 , 2 , . . . , n − 1 . Therefore, the set N can't possibly have n elements, and so n − 1 is an upper bound on the maximum number of pairwise-friendly n × n DSs. □
Now that we've established that there is, in fact, an upper bound, we proceed to find values which achieve this upper bound. We will show that for all primes p > 2 , there is a set of p − 1 pairwise-friendly p × p DSs.
Lemma 2 If p > 2 is a prime, there exists a set of p − 1 pairwise-friendly DSs.
Proof We will construct the set we want, thus proving its existence.
Consider a set S of p − 1 empty p × p arrays numbered from 1 to p − 1 . Let S t represent the array in the t th position in the set.
We proceed by filling in all the elements of S in the following manner: ∀ 1 ≤ i , j ≤ p , S ( i , j ) t = i ⋅ t + j ( m o d p ) . It is evident that the only numbers we can have in the array are the integers from 0 to p−1.
First, let's confirm that ∀ t , S t is, in fact, a DS. It suffices to show that if i ⋅ t + j ≡ i ′ ⋅ t + j ′ ( m o d p ) and i = i ′ , then j = j ′ and vice versa. Essentially, if we have two of some value in the same row, then they are also in the same column (which means they are the same position).
i ⋅ t + j ≡ i ′ ⋅ t + j ′ ( m o d p ) → t ( i − i ′ ) ≡ j − j ( m o d p ) . We remind ourselves that t = 0 . If we let either j ′ − j or i − i ′ be 0 modulo p (which means they equal 0 since they are less than p in absolute value), then the other must also equal 0 (again, because they are less than p , and the fact that p is prime guarantees that we won't have t ( i − i ′ ) = p = 0 ). Therefore, if the value of two positions in the same row/column are the same, they are the same position, and so all the S t are DSs.
Finally, we want to show that all the S t are pairwise-friendly. Consider S a and S a ′ with a = a ′ . We want the following to be true: if i ⋅ a + j ≡ i ′ ⋅ a + j ′ ( m o d p ) and i ⋅ a ′ + j ≡ i ′ ⋅ a ′ + j ′ ( m o d p ) , then i = i ′ and j = j ′ . Essentially, if we pick two sets of corresponding positions in S a and S a ′ and they end up corresponding to the same ordered pair, they are the same corresponding positions.
i ⋅ a + j ≡ i ′ ⋅ a + j ′ ( m o d p ) → a ( i − i ′ ) ≡ j ′ − j ( m o d p ) and i ⋅ a ′ + j ≡ i ′ ⋅ a ′ + j ′ ( m o d p ) → a ′ ( i − i ′ ) ≡ j ′ − j ( m o d p ) . Then we have a ′ ( i − i ′ ) ≡ a ( i − i ′ ) ( m o d p ) by the transitive property of congruence. But we know that a = a ′ and so i − i ′ ≡ 0 ( m o d p ) → i = i ′ and then j = j ′ (because once again all of i , j , i ′ , j ′ , a , a ′ ≤ p ). Thus, if two sets of corresponding positions make the same ordered pair, the two sets are the same.
This result proves that all the S t are, in fact, pairwise-friendly, and therefore, there is a set of p − 1 pairwise-friendly p × p DSs. □
Therefore, for any prime p > 2 , we have that the maximum number of pairwise friendly p × p DSs is equal to p − 1 , and so because 7 3 is a prime, the answer is 7 3 − 1 = 7 2 .
Further information: The Doku Squares in this problem are, in fact, well-known objects in mathematics called Latin Squares. "Friendly" Latin Squares are called "orthogonal." The result presented in this solution about all primes can actually be extended to all prime powers, but for a general composite number n , the maximum number of n × n orthogonal Latin Squares is not known.