Daily

Random

Practice set

Baltic Way 2023 · Problem 20

Number Theory

Let nn be a positive integer. A German set in an n×nn \times n square grid is a set of nn cells which contains exactly one cell in each row and column. Given a labelling of the cells with the integers from 1 to n2n^{2} using each integer exactly once, we say that an integer is a German product if it is the product of the labels of the cells in a German set.

(a) Let n=8n=8. Determine whether there exists a labelling of an 8×88 \times 8 grid such that the following condition is fulfilled: The difference of any two German products is always divisible by 65 .

(b) Let n=10n=10. Determine whether there exists a labelling of a 10×1010 \times 10 grid such that the following condition is fulfilled: The difference of any two German products is always divisible by 101.

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

Modular arithmetic

Solutions

Solution

(a) No, there is no such labelling.

On the contrary, we show that for every labelling there exist two German products whose difference is not divisible by 65 . Suppose that an 8×88 \times 8 square grid is labelled with the numbers 1,2,…,641,2, \ldots, 64 such that no number is used twice.

We can construct a German product that is divisible by 13 by choosing a German set that includes the cell with the label 13 and seven others in different rows and columns, but otherwise arbitrarily.

We can construct a German product that is not divisible by 13 as follows. Notice that only four labels are divisible by 13, namely 13,26,3913,26,39, and 52 . These four labels are located in at most four rows; we denote the index set of these rows R⊆[1,8]R \subseteq[1,8]. Similarly, there are at least four columns that do not contain any of these four labels; we denote the index set of these columns C⊆[1,8]C \subseteq[1,8]. Since ∣R∣≤∣C∣|R| \leq |C| it is possible to choose cells of a German set from rows RR using only columns from CC. The remaining cells are chosen from the remaining rows accordingly to the definition, but otherwise arbitrarily. The resulting German product is not divisible by 13 since the German set avoids the cells whose labels are divisible by 13 .

The difference of the two German products is not divisible by 13, since one German product is divisible by 13 whereas the other one is not. Hence the difference is not divisible by 65 . (b) Yes, there is such a labelling.

For k∈[0,99]k \in[0,99] we define ak=2k( mod 101)a_{k}=2^{k}(\bmod 101); in other words, aka_{k} is the remainder of 2k2^{k} when divided by 101. Note that ak≠0a_{k} \neq 0 since no power of 2 is divisible by 101 . Hence 1≤ak≤1001 \leq a_{k} \leq 100 for all k∈[0,99]k \in[0,99].

We label the cells of the square grid with the numbers aka_{k} as follows:

a0a_{0} a1a_{1} a2a_{2} ⋯\cdots a9a_{9}
a10a_{10} a11a_{11} a12a_{12} ⋯\cdots a19a_{19}
a20a_{20} a21a_{21} a22a_{22} ⋯\cdots a29a_{29}
⋮\vdots ⋮\vdots ⋮\vdots ⋱\ddots ⋮\vdots
a90a_{90} a91a_{91} a92a_{92} ⋯\cdots a99a_{99}

More precisely, if we label the rows and columns of the chessboard by {0,1,2,…,9}\{0,1,2, \ldots, 9\}, then the cell with coordinates (i,j)(i, j) gets the label a10i+ja_{10 i+j}.

Note that a10i+j≡210i+j( mod 101)a_{10 i+j} \equiv 2^{10 i+j}(\bmod 101) and that 210i+j=(210)i⋅2j2^{10 i+j}=\left(2^{10}\right)^{i} \cdot 2^{j}. Hence for this labelling any rook product is congruent to

(210)0+1+2+…+9⋅20+1+2+…+9\left(2^{10}\right)^{0+1+2+\ldots+9} \cdot 2^{0+1+2+\ldots+9}

modulo 101. Hence the difference of any two German products is divisible by 101 for this labelling.

It remains to show that the aka_{k} are pairwise different. (In more elaborate language, we would say that 2 is a primitive root modulo 101.) To do this, we denote by ss the smallest positive integer such that 2s≡1( mod 101)2^{s} \equiv 1(\bmod 101). Using long division, we may write 100=qs+r100=q s+r with non-negative integers qq and rr such that 0≤r≤s−10 \leq r \leq s-1. By virtue of Fermat's little theorem we have

1≡2100≡2qs+r≡(2s)q⋅2r≡1q⋅2r≡2r( mod 101).1 \equiv 2^{100} \equiv 2^{q s+r} \equiv\left(2^{s}\right)^{q} \cdot 2^{r} \equiv 1^{q} \cdot 2^{r} \equiv 2^{r} \quad(\bmod 101) .

Since r<sr<s and ss is the smallest positive integer with 2s≡1( mod 101)2^{s} \equiv 1(\bmod 101), we must have r=0r=0. In other words, 100 is divisible by ss; in other words, ss is a divisor of 100 .

We claim that s=100s=100. If this was not the case, we would have s∣20s \mid 20 or s∣50s \mid 50, which implies that 220≡1( mod 101)2^{20} \equiv 1(\bmod 101) or 250≡1( mod 101)2^{50} \equiv 1(\bmod 101). However 210=1024≡14( mod 101)2^{10}=1024 \equiv 14(\bmod 101), so that 220≡142≡196≡−6≢1( mod 101)2^{20} \equiv 14^{2} \equiv 196 \equiv-6 \not \equiv 1(\bmod 101) and 250≡(220)2⋅210≡(−6)2⋅14≡504≡−1≢1(mod101)2^{50} \equiv\left(2^{20}\right)^{2} \cdot 2^{10} \equiv(-6)^{2} \cdot 14 \equiv 504 \equiv -1 \not\equiv 1 \pmod{101}.

Now assume that k,ℓ∈[0,99]k, \ell \in[0,99] are positive integers with k>ℓk>\ell and ak=aℓa_{k}=a_{\ell}. Then we have 2k≡2ℓ( mod 101)2^{k} \equiv 2^{\ell}(\bmod 101) and 0≡2k−2ℓ≡2ℓ⋅(2k−ℓ−1)( mod 101)0 \equiv 2^{k}-2^{\ell} \equiv 2^{\ell} \cdot\left(2^{k-\ell}-1\right)(\bmod 101). Since 2ℓ2^{\ell} and 101 are coprime, it follows that 2k−ℓ−1≡0( mod 101)2^{k-\ell}-1 \equiv 0(\bmod 101) and 2k−ℓ≡1( mod 101)2^{k-\ell} \equiv 1(\bmod 101). This cannot be true, since k−ℓ∈[1,99]k-\ell \in[1,99], but s=100s=100 is the smallest positive integer with 2s≡1( mod 101)2^{s} \equiv 1(\bmod 101). Hence ak≠aℓa_{k} \neq a_{\ell}.

We conclude that the numbers aka_{k} with k∈[0,99]k \in[0,99] are a hundred pairwise different numbers from the set [1,100][1,100], hence they are a permutation of the set [1,100][1,100] as it was required.

Solution 2

Definition. Let pp be a prime. Consider an n×nn \times n square grid of elements ai,j∈Fp∗a_{i, j} \in \mathbb{F}_{p}^{*} (for i,j=1,…,ni, j=1, \ldots, n ), which are not necessarily distinct. We call it rooky, if all its German products are equal as elements in Fp∗\mathbb{F}_{p}^{*}.

We will provide a classification of all rooky square grids. Of course, most of this is not necessary when writing down a solution to the given problem, but it may still be interesting...

Lemma: A square grid is rooky if and only if for all i,j,k,ℓi, j, k, \ell :

ai,j⋅ak,ℓ=ai,ℓ⋅ak,ja_{i, j} \cdot a_{k, \ell}=a_{i, \ell} \cdot a_{k, j}

Proof. If we swap the rows of two cells in a German set and keep their columns, it turns one valid German set into another. When comparing their German products, we can ignore all n−2n-2 labels of cells that were not moved. The remaining values are ai,j⋅ak,ℓa_{i, j} \cdot a_{k, \ell} resp. ai,ℓ⋅ak,ja_{i, \ell} \cdot a_{k, j} for certain i,j,k,ℓi, j, k, \ell. This gives equality (1) for rooky square grids.

Conversely assume that (1) holds. Then we have to compare two arbitrary German products. But they can transformed into each other by a sequence of several swaps of two cells. Due to (1) the German product does not change at any of these steps, so the rook products of the original configurations are the same as well.

Lemma: A rooky square grid is uniquely determined by the elements of its first row and first column.

Proof. Indeed the previous lemma implies that

ai,j⋅a1,1=ai,1⋅a1,ja_{i, j} \cdot a_{1,1}=a_{i, 1} \cdot a_{1, j}

which determines ai,ja_{i, j} uniquely because a1,1a_{1,1} is a unit.

One can actually prove directly that the square grid obtained that way is rooky, but it is simpler to continue directly to

Proposition: Let λi∈Fp∗(i=1,…,n)\lambda_{i} \in \mathbb{F}_{p}^{*}(i=1, \ldots, n) and μj∈Fp∗(j=1,…,n)\mu_{j} \in \mathbb{F}_{p}^{*}(j=1, \ldots, n) arbitrary elements. Then the square grid with

ai,j=λi⋅μja_{i, j}=\lambda_{i} \cdot \mu_{j}

is rooky. Moreover any rooky square grid can be obtained this way.

Proof. The square grid with ai,j=λi⋅μja_{i, j}=\lambda_{i} \cdot \mu_{j} is rooky, because any German product has the value

∏iλi⋅∏jμj.\prod_{i} \lambda_{i} \cdot \prod_{j} \mu_{j} .

Let us prove the converse: By the previous lemma, it suffices to find λi s\lambda_{i} \mathrm{~s} and μj s\mu_{j} \mathrm{~s} that recreate the values of the first row and column. For this simply set λi=ai,1\lambda_{i}=a_{i, 1} and μj=a1,ja1,1\mu_{j}=\frac{a_{1, j}}{a_{1,1}}.

Proposition: For any prime p>n2p>n^{2}, there exists a rooky square grid with only distinct elements.

Proof. Choose any primitive root α∈Fp∗\alpha \in \mathbb{F}_{p}^{*}. Then set λi=αi−1,μj=αn⋅(j−1)\lambda_{i}=\alpha^{i-1}, \mu_{j}=\alpha^{n \cdot(j-1)} and ai,j=λi⋅μj=αi−1+n⋅(j−1)a_{i, j}=\lambda_{i} \cdot \mu_{j}=\alpha^{i-1+n \cdot(j-1)}. This provides indeed a rooky square grid. The values in the square are α0,α1,…,αn2−1\alpha^{0}, \alpha^{1}, \ldots, \alpha^{n^{2}-1}. As we have chosen a primitive root, these are all distinct.

For n=10,p=101n=10, p=101 and α=2\alpha=2, this reproduces exactly the construction given in the previous solution.

Contest context

Results from Baltic Way 2023

10 teams

Mean score
2.8 / 5
Scores of 4 or 5
5 / 10
Estonia
5 / 5

Score distribution

03
10
22
30
41
54
All team scores
TeamScore
Germany5 / 5
Sweden5 / 5
Lithuania5 / 5
Poland0 / 5
Estonia5 / 5
Latvia0 / 5
Norway4 / 5
Denmark2 / 5
Finland2 / 5
Iceland0 / 5