Let $n>1$ be a positive integer. Each cell of an $n\times n$ table contains an integer. Suppose that the following conditions are satisfied: Each number in the table is congruent to $1$ modulo $n$. The sum of numbers in any row, as well as the sum of numbers in any column, is congruent to $n$ modulo $n^2$. Let $R_i$ be the product of the numbers in the $i^{\text{th}}$ row, and $C_j$ be the product of the number in the $j^{\text{th}}$ column. Prove that the sums $R_1+\hdots R_n$ and $C_1+\hdots C_n$ are congruent modulo $n^4$.
Problem
Source: ISL 2018 N2
Tags: IMO Shortlist, number theory, Hi
17.07.2019 15:31
Proposed by Tobi Moektijono, Indonesia
17.07.2019 15:54
We present two solutions: first, a sort of mechanical approach which reveals some underlying traps in the problem, and a second elegant approach that hides them. First solution by brute force (mine) We denote the numbers in the grid by $1 + na_{i,j}$ in the obvious way, meaning that the given states that $n$ divides $a_{i,1} + \dots + a_{i,n}$ and $a_{1,j} + \dots + a_{n,j}$ for any $i$ or $j$. In what follows, I'm going to take be actually working with addition modulo $1$: write $a \equiv b \pmod 1$ if $a-b \in {\mathbb Z}$. (This works fine as long as we are careful to not multiply.) Our goal is to show that $\frac{\sum_i R_i - \sum_j C_j}{n^4} \equiv 0 \pmod 1$. We begin by computing $R_i$ carefully. Let \[ r_i(k) \overset{\text{def}}{=} a_{i,1}^k + \dots + a_{i,n}^k \]denote the sum of the $k$th powers in the $n$th row, which we are given is divisible by $n$. Then we compute $R_i$ in terms of $r_i(k)$ for $k \le 3$: \begin{align*} \frac{R_i}{n^4} &= \frac{1}{n^4} \prod_j \left( 1 + n a_{i,j} \right) \\ &\equiv \frac{1 + n\sum_j a_{i,j} + n^2 \sum_{j_1 < j_2} a_{i,j_1} a_{i,j_2} + n^3 \sum_{j_1 < j_2 < j_3} a_{i,j_1} a_{i,j_2} a_{i,j_3}}{n^4} \pmod 1 \\ &= \frac{1}{n^4} + \frac{r_i(1)}{n^3} + \frac{r_i(1)^2-r_i(2)}{2n^2} + \frac{2r_i(3) + r_i(1)^3 - 3r_i(1)r_i(2)}{6n} \\ &= \frac{1+nr_i(1) - \frac{1}{2} n^2 r_i(2) + \frac13 n^3 r_i(3)}{n^4} + \frac{r_i(1)^2}{2n^2} + \frac{r_i(1)^3}{6n} - \frac{r_i(1)r_i(2)}{2n}. \end{align*}However, \[ \sum_i \left[ 1+nr_i(1) - \frac{1}{2} n^2 r_i(2) + \frac13 n^3 r_i(3) \right] = n + \sum_{i,j} \left[ na_{i,j} - \frac{1}{2} n^2 a_{i,j}^2 + \frac 13 n^3 a_{i,j}^3 \right] \]which is symmetric with respect to rows and columns. So if we define $c_j(k)$ in an analogous way, and compute $\frac{1}{n^4}( \sum_i R_i - \sum_j C_j)$, the first fraction cancels entirely and we get \begin{align*} \frac{\sum_i R_i - \sum_j C_j}{n^4} &\equiv \frac{\sum_i r_i(1)^3 - \sum_j c_j(1)^3}{6n} - \frac{\sum_i r_i(1) r_i(2) - \sum_j c_j(1) c_j(2)}{2n} \\ &\phantom{\equiv} + \frac{\sum_i r_i(1)^2 - \sum_j c_j(1)^2}{2n^2} \pmod 1 \\ &\equiv \frac{\sum_i r_i(1)^3 - \sum_j c_j(1)^3}{6n} - \frac{\sum_i r_i(1)^2 - \sum_j c_j(1)^2}{2n} \\ &\phantom{\equiv} + \frac{\sum_i r_i(1)^2 - \sum_j c_j(1)^2}{2n^2} \pmod 1 \end{align*}where the last line is since $r_i(2) \equiv r_i(1) \pmod 2$, thus $r_i(1) r_i(2) \equiv r_i(1)^2 \pmod{2n}$. We wish to show the right-hand side is an integer. In fact, we claim all three fractions above are integers. To do this, it is enough to check: Claim: Let $p$ be a prime which divides $n$. Then the $\nu_p(\cdot)$ of each of the three fractions is positive. Proof. For the first fraction, we have \[ \nu_p\left( r_i(1)^3 \right) = 3\nu_p(n) \ge \nu_p(6n) \]and similarly for $c_j(1)^3$, which implies the result for the first fraction (since we assumed $\nu_p(n) > 0$). The proof for the second fraction is the same. For the final fraction, the result is obvious for $p>2$. For $p=2$ we note that $\sum_i r_i(1) = \sum_j c_j(1)$, and hence the number of terms on each side with exponent of $2$ equal to $\nu_2(n)$ (the minimum possible) must be equal mod $2$. So among the $2n$ terms of $\sum_i r_i(1)^2 - \sum_j c_j(1)^2$, the number of terms with $2$-adic exponent $2\nu_2(n)$ is even, and hence together those terms are divisible by $2n^2$. The rest of the terms are divisible by $4n^2$, so the result follows. $\blacksquare$ Since the left-hand side is in $\frac{1}{n^4}{\mathbb Z}$ it follows the expression is an integer, as desired. Remark: I thought this solution is direct, but there is a big pitfall with division buried inside this approach, which is why the argument looks so convoluted later on. It might be tempting to try to write \[ R_i \equiv 1 + n r_i(1) + n^2 \cdot \frac{r_i(1)^2-r_i(2)}{2} + n^3 \cdot \frac{r_i(1)^3 + 2r_i(3) - 3r_i(1)r_i(2) }{3} \pmod{n^4} \]and finish directly by appealing to the fact that $r_i(1) \equiv 0 \pmod n$ to eliminate all but the isolated terms that cancelled earlier. This would indeed work if $\gcd(n,6) = 1$. However, when $\gcd(n,6) \neq 1$, one runs into trouble with the denominators above: it is no longer true that $n^2 \cdot \frac{r_i(1)^2}{2} \equiv 0 \pmod{n^4}$, for example, and significant care must be taken. That is why the argument is written in the less natural ``mod $1$'' framework, to emphasize that we are not doing the usual modular arithmetic (and accordingly to keep readers on appropriate guard). Second trickier approach (official solution) Again denote the numbers by $1 + na_{i,j}$ in the obvious way. Let $P = \prod_i \prod_j (1 + na_{i,j})$. We will show that \[ \sum_i R_i \equiv (n-1) + P \pmod{n^4} \]which will imply the result. First, note that $R_i \equiv 1 \pmod{n^2}$ for any $i$. This follows from an excerpt of the calculation in Solution 1; one notes $\prod_j (1+na_{i,j}) \equiv 1 + n(a_{i,1} + \dots + a_{i,n}) \equiv 1 \pmod{n^2}$. Then, \begin{align*} P &= \prod_i R_i = \prod_i \left( 1 + (R_i-1) \right) \\ & \equiv 1 + \sum_i (R_i-1) \equiv -(n-1) + \sum_i R_i \pmod{n^4}. \end{align*}since the product of any two terms of the form $R_i-1$ is divisible by $n^2 \cdot n^2 = n^4$. End proof.
17.07.2019 17:56
Another brute force solution First, we will abuse the sigma notations. Let $\sum a_i$ denotes $\sum\limits_{i=1}^n a_i$, $\sum a_ia_j$ denotes $\sum\limits_{1\leqslant i < j\leqslant n} a_ia_j$ and $\sum a_ia_ja_k$ denotes $\sum\limits_{1\leqslant i < j < k\leqslant n} a_ia_ja_k$. Claim: Let a row has entries $r_i=a_in+1$ ($i=1,2,...,n$). Then $$r_1r_2...r_n \equiv \frac{n^3}{3}\sum a_i^3 - \frac{n^2}{2}\sum a_i^2 + \left(\frac{n^3}{2}+n\right)\sum a_i + 1 \pmod{n^4}$$ Proof: The given conditions imply $n\mid a_1+a_2+...+a_n$. Clearly, $$r_1r_2...r_n\equiv n^3\sum a_ia_ja_k + n^2\sum a_ia_j + n\sum a_i + 1\pmod{n^4}.$$Now we recall the following identities, \begin{align*} \sum a_ia_j &= \frac{1}{2}\left[\left(\sum a_i\right)^2 - \sum a_i^2\right] \\ \sum a_ia_ja_k &= \frac{1}{6}\left[\left(\sum a_i\right)^3 - 3\left(\sum a_i^2\right)\left(\sum a_i\right) + 2\left(\sum a_i^3\right)\right]. \end{align*}By collecting massive amount of terms, it suffices to show that $$\frac{n^3}{6}\left(\sum a_i\right)^3 - \frac{n^3}{2}\left(\sum a_i^2\right)\left(\sum a_i\right) + \frac{n^2}{2}\left(\sum a_i\right)^3 - \frac{n^3}{2}\sum a_i \equiv 0\pmod{n^4} $$We take care of the last two first. These terms combined are equal to $$n^4\times \frac{K^2-K}{2} \equiv 0\pmod{n^4}$$where $K=\dfrac{\sum a_i}{n}$. For the first two, note that \begin{align*} \frac{n^3}{6}\left(\sum a_i\right)^3 &= n^4 \cdot K^3 \cdot \frac{n^2}{6} \\ \frac{n^3}{2}\left(\sum a_i^2\right)\left(\sum a_i\right) &= n^4 \cdot K \cdot \frac{\sum a_i^2}{2} \end{align*}Since $\gcd(n^4,6)$ always divide $n^2$, linear congruence $6x\equiv n^2\pmod{n^4}$ always have the solution which means the first term is always $\equiv 0\pmod n$. Moreover, if $2\mid n$ then $2\mid\sum a_i^2$, otherwise $2^{-1}$ exists in $\pmod{n^4}$. Thus the second term is $\equiv 0\pmod n$ as well. Hence we are done. The problem is now easily solved by just summing the claim over all rows and all columns.
10.08.2019 00:57
Wow... what a problem- isn’t this a little convoluted for an N2? I wouldn’t say hard, because the steps are actually quite intuitive after writing the obvious $a_{ij}=k_{ij}n+1$ and expanding everything, taking $\mod n^4$ and grouping everything- I’m not going to write my solution as it’s basically the same as @above, but the solution is quite lengthy and it’s necessary to be very cautious before jumping to any sort of conclusions... reiterating, isn’t this a bit convoluted for a candidate for P1/4?
18.08.2019 21:52
The idea to repeatedly multiply sums, expand, and add everything up is straightforward, but the writeup is annoying. Hopefully the solution below is reasonably comprehensible (and correct!). Let $\{a_{ij}\}$ be the numbers one less than those in the grid, i.e. each $a_{ij}$ is divisible by $n$ and the sum of the entries in a row/column is divisible by $n^2$. Let $R$ be the set of rows and $C$ be the set of columns. It suffices to show that \[\sum_{r \in R} \prod_{a_i \in r} (a_i+1) \equiv \sum_{c \in C} \prod_{a_j \in c} (a_j+1) \pmod{n^4}\](Note: I will use $\sum_R$ to sum over all rows, where the $a_i$ within the sum are the numbers in a particular row. I also get a little lazy with indexing, oops.) \[\iff \sum_{R} \left(\sum_{1 \le i <j \le n} a_ia_j + \sum_{1 \le i < j < k \le n} a_ia_ja_k \right) \equiv \sum_{C} \left(\sum_{1 \le i <j \le n} a_ia_j + \sum_{1 \le i < j < k \le n} a_ia_ja_k \right) \pmod{n^4}.\]Divide each number in the grid by $n$ and note that for each $i$ we have $R_i = \sum_{a \in r_i}a \equiv 0 \pmod n$ and similarly $C_i \equiv 0 \pmod{n}$ for columns. The desired congruence is equivalent to \[\sum_{R} \sum a_ia_j +\sum_{R} n\sum a_ia_ja_k \equiv \sum_{C} \sum a_ia_j + \sum_{C}n\sum a_ia_ja_k \pmod{n^2}. \quad (\heartsuit)\] Claim 1: $\sum_{R} \sum a_ia_j \equiv \sum_{C} \sum a_ia_j \pmod{n^2}$
Claim 2: $\sum_{R} \sum a_ia_ja_k \equiv \sum_{C} \sum a_ia_ja_k \pmod{n}$
Claims 1 and 2 imply $(\heartsuit)$, so we are done.
08.10.2019 19:26
This was a very stupid bash Let the square in position $(i, j)$ be labeled with $1 + nx_{ij}$. Then we have $$R_{i} = (nx_{i1} + 1)(nx_{i2} + 1) \dots (nx_{in} + 1) \equiv n^3 \sum_{a, b, c, a \neq b \neq c} x_{ia}x_{ib}x_{ic} + n^2 \sum_{a, b, a \neq b} x_{ia} x_{ib} \pmod{n^4}$$via a straightforward computation. Similarly, $$S_{i} \equiv (nx_{1i} + 1)(nx_{2i} + 1) \dots (nx_{ni} + 1) \equiv n^3\sum_{a, b, c, a \neq b \neq c} x_{ai}x_{bi}x_{ci} + n^2 \sum_{a, b, a \neq b} x_{ai} x_{bi} \pmod{n^4},$$so the desired congruence is equivalent to $$n \sum_{i = 1}^{n} \sum_{a, b, c, a \neq b \neq c} x_{ai}x_{bi}x_{ci} + \sum_{i = 1}^{n} \sum_{a, b, a \neq b} x_{ai} x_{bi} \equiv n \sum_{i = 1}^n \sum_{a, b, c, a \neq b \neq c} x_{ia}x_{ib}x_{ic} + \sum_{i = 1}^n \sum_{a, b, a \neq b} x_{ia} x_{ib} \pmod{n^2}.$$ Claim 1: $\sum_{i = 1}^{n}\sum_{a, b, a \neq b} x_{ai} x_{bi} \equiv \sum_{i = 1}^n \sum_{a, b, a \neq b} x_{ia} x_{ib} \pmod{n^2}$ Proof: Let $r_i$ denote the sum of the entries in the $i$th row, and $c_i$ be the sum of the entries in the $i$th column. Now we have that $$\text{LHS} = \sum_{i = 1}^n r_{i}^2 - \text{the sum of the squares of all the elements in the table}$$and $$\text{RHS} = \sum_{i = 1}^n c_{i}^2 - \text{the sum of the squares of all the elements in the table}.$$The result holds as $\sum_{i = 1}^n r_{i}^2 \equiv \sum_{i = 1}^n c_{i}^2 \equiv 0 \pmod{n^2}$. Claim 2: $\sum_{i = 1}^{n} \sum_{a, b, c, a \neq b \neq c} x_{ai}x_{bi}x_{ci} \equiv \sum_{i = 1}^{n} \sum_{a, b, c, a \neq b \neq c} x_{ia}x_{ib}x_{ic} \pmod{n}$ Proof: Left as an exercise, it's not hard and I really don't want to do anymore Latex The $2$ claims imply the desired congruence, so we are done. $\blacksquare$
18.10.2019 19:15
Let the square in the $i^{th}$ column in the $j^{th}$ row have the number $a_{i,j}$. For each $a_{i,j}$ consider the number $b_{i,j}$ which is the remainder when $a_{i,j}$ is divided by $n^4$. Thus $b_{i,j}$ is of the form $f_{i,j}n^3+d_{i,j}n^2+e_{i,j}n+1$ where all the $f_{i,j}, d_{i,j}, e_{i,j}$ are intgers between $0$ and $n$. We are given that for any integer $1 \leq a \leq n$ we have $n|e_{a,1}+e_{a,2}+...e_{a,n}$ as well as $n|e_{1,a}+e_{2,a}+...e_{n,a}$. Now note that $R_1+R_2+R_3+...R_n$ is congruent to $Bn^3+Cn^3+Dn^2+En+n^2$ mod $n^4$ and $C_1+C_2+...C_n$ is congruent to $Bn^3+Fn^3+Dn^2+En+n^2$ mod $n^4$ where $B$ is the sum of all the $f_{i,j}$, $D$ is the sum of all the $d_{i,j}$ and $E$ is the sum of all the $e_{i,j}$, and we have $C$ is the sum of all products of the form $e_{i,a}e_{j,a}$ and $F$ is the sum of all products of the form $e_{a,i}e_{j,i}$. All of this comes due to expansion. We have to just show that $C-F$ is $0$ mod $n$. Note that because of the problem condition, it is easy to see that if we change the $e_{i,j}$ of one of the entries $b_{i,j}$ while keeping everything else constant, $C-F$ remains invariant mod $n$. Thus $C-F$ wouldn't change mod $n$ if all $e_{i,j}$ are $0$, thus $n|C-F$, and hence we get that $n^4|(R_1+R_2+...R_n)-(C_1+C_2+...C_n)$. Proved.
29.11.2019 23:41
Label the board as v_Enhance did above (with $1 + n a_{i, j}$, $1 \le i, j \le n$). We consider the following operation. Select four numbers $1 \le i, j, k, \ell \le n$ so that $i \neq k$ and $j \leq \ell.$ Add $1$ to $a_{i, j}$ and $a_{k, \ell}$ and then subtract $1$ to $a_{i, \ell}$ and $a_{k, j}.$ It's clear that the conditions of the problem are preserved under this operation. We will show that the quantity $\sum_{x = 1}^{n} R_x - \sum_{y= 1}^{n} C_y$ is preserved modulo $n^4$ under this operation. Note that $R_i$ changes by $(-n^2 a_{i, j} + n^2 a_{i, \ell} - n^2) \prod_{z \neq j, \ell} (1 + n a_{i, z}).$ Modulo $n^4$, this is equivalent to: $$n^2(-a_{i, j} + a_{i, \ell} - 1) (1 - n a_{i, j} - n a_{i, \ell}) \equiv -n^2 + n^2(a_{i, \ell} - a_{i, j}) +n^3 (a_{i, j} + a_{i, \ell})-n^3(a_{i, \ell}^2 - a_{i, j}^2).$$ With similar results for the changes in $R_k, C_j,$ and $C_{\ell}$, it's easy to see that $R_i + R_k - C_j - C_{\ell}$ doesn't change modulo $n^4$ under this operation. Since the other $R_x$'s and $C_y$'s don't change either, it's clear that $\sum_{x = 1}^{n} R_x - \sum_{y= 1}^{n} C_y$ is preserved modulo $n^4$ under this operation. In view of this, we can apply the operation until all $a_{i, j}$'s for $1 \le i \le n-1, 1 \le j \le n$ are divisible by $n.$ This is clearly doable, as we can just start by making $a_{1, j}$'s all divisible by $n$, then $a_{2, j}$'s, etc. But then, because the conditions of the problem are preserved by the operation, we have that $a_{i, j}$ is divisible by $n$ for all $1 \le i, j \le n.$ Hence, we can define the integers $b_{i, j} = \frac{a_{i, j}}{n}$ for each $1 \le i, j \le n,$ so that the numbers in the table are of the form $n^2 b_{i, j} + 1$ now. We now know that $R_i$ is equivalent to: $$1 + n^2 \sum_{j= 1}^{n} b_{i, j},$$ for each $1 \le i \le n.$ With similar results for the $C_j$'s, it's clear that $\sum_{x = 1}^{n} R_x - \sum_{y=1}^{n} C_y$ is congruent to $0$ (mod $n^4$) in the end. Hence, reversing the said operations, the problem is solved. $\square$
19.05.2020 20:14
sriraamster wrote: This was a very stupid bash Let the square in position $(i, j)$ be labeled with $1 + nx_{ij}$. Then we have $$R_{i} = (nx_{i1} + 1)(nx_{i2} + 1) \dots (nx_{in} + 1) \equiv n^3 \sum_{a, b, c, a \neq b \neq c} x_{ia}x_{ib}x_{ic} + n^2 \sum_{a, b, a \neq b} x_{ia} x_{ib} \pmod{n^4}$$via a straightforward computation. Similarly, $$S_{i} \equiv (nx_{1i} + 1)(nx_{2i} + 1) \dots (nx_{ni} + 1) \equiv n^3\sum_{a, b, c, a \neq b \neq c} x_{ai}x_{bi}x_{ci} + n^2 \sum_{a, b, a \neq b} x_{ai} x_{bi} \pmod{n^4},$$so the desired congruence is equivalent to $$n \sum_{i = 1}^{n} \sum_{a, b, c, a \neq b \neq c} x_{ai}x_{bi}x_{ci} + \sum_{i = 1}^{n} \sum_{a, b, a \neq b} x_{ai} x_{bi} \equiv n \sum_{i = 1}^n \sum_{a, b, c, a \neq b \neq c} x_{ia}x_{ib}x_{ic} + \sum_{i = 1}^n \sum_{a, b, a \neq b} x_{ia} x_{ib} \pmod{n^2}.$$ Claim 1: $\sum_{i = 1}^{n}\sum_{a, b, a \neq b} x_{ai} x_{bi} \equiv \sum_{i = 1}^n \sum_{a, b, a \neq b} x_{ia} x_{ib} \pmod{n^2}$ Proof: Let $r_i$ denote the sum of the entries in the $i$th row, and $c_i$ be the sum of the entries in the $i$th column. Now we have that $$\text{LHS} = \sum_{i = 1}^n r_{i}^2 - \text{the sum of the squares of all the elements in the table}$$and $$\text{RHS} = \sum_{i = 1}^n c_{i}^2 - \text{the sum of the squares of all the elements in the table}.$$The result holds as $\sum_{i = 1}^n r_{i}^2 \equiv \sum_{i = 1}^n c_{i}^2 \equiv 0 \pmod{n^2}$. Claim 2: $\sum_{i = 1}^{n} \sum_{a, b, c, a \neq b \neq c} x_{ai}x_{bi}x_{ci} \equiv \sum_{i = 1}^{n} \sum_{a, b, c, a \neq b \neq c} x_{ia}x_{ib}x_{ic} \pmod{n}$ Proof: Left as an exercise, it's not hard and I really don't want to do anymore Latex The $2$ claims imply the desired congruence, so we are done. $\blacksquare$ Copying the second official sol! !!!
01.07.2020 05:50
For some reason, I ended up solving the problem using the same method as the more synthetic solution. Probably because I'm too lazy to bash. Oh well. Anyways, here is my solution with the motivation behind each step: Again, from the problem conditions, it is evident the number listed in some row and column $i, j$ can be written in the form $1+na_{i,j}$ where \begin{align} \sum_{k=1}^{n} a_{i,k} \equiv 0 \pmod{n} \end{align}I first thought to investigate $R_i$ by multiplying and seeing what happens: \begin{align} \setcounter{equation}{1} R_i = \prod_{k=1}^{n} (1+na_{i,k}) \equiv 1+n\sum_{k=1}^n a_{i,k} \equiv 1 \pmod{n^2} \end{align}Where the above congruence follows from $(1)$. I chose to take modulo $n^2$ as it yielded the cleanest result. Thus we can write $R_i = 1+n^2r_i$. Next, I realized I could jump from modulo $n^2$ to modulo $n^4$ by using the same multiplying technique as $(2)$. Letting $P$ denote the product of all grid entries, we obtain \begin{align} \setcounter{equation}{2} P = \prod_{k=1}^{n} R_k = \prod_{k=1}^{n} (1+n^2r_k) \equiv 1 + n^2\sum_{k=1}^{n} r_k = \sum_{k=1}^{n} R_k - (n-1) \pmod{n^4} \end{align}The rest was obvious. Applying a symmetrical argument to the columns, we find that \begin{align} \setcounter{equation}{3} P \equiv \sum_{k=1}^{n} C_k - (n-1) \pmod{n^4} \end{align}So from equating $(3)$ and $(4)$, $$\sum_{k=1}^{n} R_k \equiv \sum_{k=1}^{n} C_k \pmod{n^4}$$as desired.
20.07.2020 01:08
Let $x_{ij}=1+ny_{ij}$ be the entry in $(i,j)$. Then $y_{i1}+\cdots+y_{in}\equiv 0 \pmod{n}$ and $y_{1i}+\cdots+y_{ni}\equiv 0 \pmod{n}$ for each $i=1,\ldots,n$. Now, $R_i=(1+ny_{i1})\cdots (1+ny_{in})$. The sum of $R_i$ mod $n^4$ over $i=1,\ldots,n$ expands as \[ \sum_{i=1}^n \left[ 1+n(y_{i1}+\cdots+y_{in}) + \binom{n}{2}n^2(y_{i1}y_{i2}+\cdots) + \binom{n}{3}n^3 (y_{i1}y_{i2}y_{i3}+\cdots) \right]\]since all subsequent terms are divisible by $n^4$. For the sum of $C_i$, simply change $y_{ij}$ to $y_{ji}$ for each $i,j$; call this \textit{flipping} the expression. In the above 4 terms, the first two are obviously the same after flipping, after summing over $i$. For the third term, it suffices to show that \[ S := \sum_{i=1}^n \sum_{a=1}^n \sum_{b>a} y_{ia}y_{ib} \pmod{n^2}\]is invariant under flipping. Let $S'$ denote the flip of $S$. We know $(y_{i1}+\cdots+y_{in})^2\equiv 0 \pmod{n^2}$, so \[2\sum_{a=1}^n \sum_{b>a} y_{ia}y_{ib} \equiv -\sum_{a=1}^n y_{ia}^2 \pmod{n^2}.\]Summing this over all $i$ gives that $2S \equiv -(y_{11}^2+\cdots+y_{nn}^2) \pmod{n^2}$, which is clearly invariant under flipping. Therefore, $2S \equiv 2S' \pmod{n^2}$. If $2\nmid n$, this gives $S\equiv S' \pmod{n^2}$. If $2\mid n$, then actually $S\equiv -\tfrac12(y_{11}^2+\cdots+y_{nn}^2) \pmod{n^2}$, which is also invariant under flipping. For the fourth term, we want to show that \[ T:= \sum_{i=1}^n \sum_{a=1}^n \sum_{b>a} \sum_{c>b} y_{ia}y_{ib}y_{ic} \pmod{n} \]is invariant under flipping. Let $T'$ denote the flip of $T$. We want to decompose \[ 6\sum_{1\le a<b<c \le n} y_{ia}y_{ib}y_{ic} = k_1\left(\sum_{a=1}^n y_{ia}\right)^3 + k_2 \left( \sum_{a=1}^n y_{ia}^2\right)\left( \sum_{a=1}^n y_{ia} \right)+k_3 \left( \sum_{a=1}^n y_{ia}^3\right)\]for some constants $k_1,k_2,k_3$. Plugging in some small tuples mostly filled with 0's for $y$ allows us to solve for $k$'s: we get $k_1=1,k_2=-3,k_3=2$. Since $y_{i1}+\cdots+y_{in}\equiv 0 \pmod{n}$, the first two of the three terms are clearly 0 mod $n$. Summing the third term over all $i$ just gives $k_3(y_{11}^3+\cdots+y_{nn}^3)$, which is also symmetric in flipping. Therefore, $6T\equiv 6T' \pmod{n}$. If $3\mid n$, then $3\mid \sum_{a=1}^n y_{ia}$, so it divides all the three terms, which is good, and if $2\mid n$, the same holds (we can formalize this with $v_p$'s); therefore, $T\equiv T' \pmod{n}$. This completes the proof.
23.03.2021 05:35
Let the element in the $i$-th row and $j$-th column be $k_{i,j}n+1$. It is clear that \begin{align*} \forall i, \sum_j k_{i,j}&\equiv 0\pmod{n}\\ \forall j,\sum_i k_{i,j}&\equiv 0\pmod{n}. \end{align*}Then, note that \[R_i\equiv n\sum_j k_{i,j}+1\equiv 1\pmod{n^2}\]for each $i$. Since $R_1R_2\cdots R_n=C_1C_2\cdots C_n$, let $t(a)=(a-1)/n^2$ and note that modulo $n^4$ we have \[R_1\cdots R_n\equiv n^2\sum_i t(R_i)+1.\]Hence $\sum_i t(R_i)\equiv \sum_j t(C_j)\pmod{n^2}$. This finishes by summing over all $i$ and $j$.
10.04.2021 11:35
This is a hard-to-write problem but the idea is that we should write each number this way: x=k×n^2+t×n+1
17.04.2021 07:11
GeronimoStilton wrote: Note that modulo $n^4$ we have \[R_1\cdots R_n\equiv n^2\sum_i t(R_i)+1.\] Why((((, can someone explain please
18.04.2021 15:53
Someone?
14.08.2021 04:12
Notice that the only possible residues for an element of the table mod $n^2$ are $an+1$ for $0\le a\le n-1$. For every integer in the grid, if it is equal to $an+1 \pmod {n^2}$ for $1\le a\le n-1$, call $a$ the label of that integer. Take labels mod $n$, so that a label of $a+n$ is the same as a label of $a$. As the sum of the numbers in any row or column is equal to $n \pmod {n^2}$, the sum of the labels of all integers in any row and column is equivalent to $0$ mod $n$. Claim: Changing an integer by an integer multiple of $n^2$ does not change the difference between $R_1+\ldots+R_n$ and $C_1+\ldots+C_n$ mod $n^4$. Proof. WLOG let the integer changed be in the first row and first column, and have label $x$. Then we need to prove that $R_1$ and $C_1$ get changed by the same amount mod $n^4$. $R_1$ gets changed by a multiple of $n^2$ multiplied by the product of the remainder of numbers in the row. It suffices to consider the product of the remainder of the numbers mod $n^2$. If there are two numbers with labels $a$ and $b$, their product is congruent to $$(an+1)(bn+1)\equiv (a+b)n+1 $$mod $n^2$, and therefore their product is $1$ mod $n$ and has a label of $a+b$. Thus, if all the remaining numbers in the first row were multiplied, the product mod $n^2$ would have a label equal to the sum of the labels of all such integers, which is equal to $-x$. Therefore the change in $R_1$ is equivalent to $(-xn+1)(cn^2)$ mod $n^4$ for some $c$. However, using the same reasoning for $C_1$, we are done. $\blacksquare$ Thus, we can assume that all numbers are between $0$ and $n^2$, and so every label $a$ mod $n$ corresponds to a unique number $an+1$. It is well-known that if we are given labels for the numbers in the top left $(n-1)\times (n-1)$ subsquare, we can uniquely fill out labels for the rest of the entries in the grid so that in every row and column the sum of the labels is $0$ mod $n$. Thus it suffices to prove that for any set of labels we can put in the $(n-1)\times (n-1)$ subsquare, the resulting grid has the desired property. We will use induction on the sum of the remainders of the labels mod $n$ in the subsquare. The base case, where this quantity is $0$, only occurs when the labels in the subsquare are all $0$, creating a grid of only labels $0$, corresponding to a grid of all $1$, which clearly has the desired property. The inductive step will be proven by the following claim. Claim: If $1$ is added to a label of an integer in the subsquare, then the difference between $R_1+\ldots+R_n$ and $C_1+\ldots+C_n$ does not change mod $n^4$. Proof.WLOG assume that number is in the first row and first column again, having original label $a$. Then the only changes in the resulting grid is that $1$ is subtracted from the labels in the $n$ column of the first row (having original label $b$), and the first column of the $n$th row (having original label $c$), as well as adding $1$ to the label of the integer in the $n$th column and the $n$th row (having original label $d$). Thus, only $R_1,R_n,C_1,C_n$ will change. $R_1$ will change by the change in product of the two entries changed multiplied by the product of the unchanged integers in the first row. The change in product of the two entries changed is equal to $$((a+1)n+1)((b-1)n+1)-(an+1)(bn+1)=n^2(-a+b-1).$$Thus, it suffices to find the product of the unchanged elements in the first row mod $n^2$, by the reasoning in the first claim, as the sum of the labels of all such integers is equal to $-a-b$, this is equal to $n(-a-b)+1$. Thus the change in $R_1$ mod $n^4$ is equal to $n^2(-a+b-1)(n(-a-b)+1)$. Similarly, the change in $R_n$ is equal to $n^2(-d+c-1)(n(-c-d)+1)$, the change in $C_1$ is $n^2(-a+c-1)(n(-a-c)+1)$, and the change in $C_n$ is $n^2(-d+b-1)(n(-b-d)+1)$. We can ignore the factor of $n^2$ because it appears in every change. It is straightforward to check that $(-a+b-1)(n(-a-b)+1)+(-d+c-1)(n(-c-d)+1)$ and $(-a+c-1)(n(-a-c)+1)+(-d+b-1)(n(-b-d)+1)$ are both equal to $$-2-a+b+c-d+(a+b+c+d)n-na^2+nb^2+nc^2-nd^2,$$and thus the claim is proven.$\blacksquare$ This claim proves the inductive step because it shows for a particular set of labels, subtracting one from a label does not change the difference between $R_1+\ldots+R_n$ and $C_1+\ldots+C_n$ mod $n^4$, implying we can use the induction hypothesis to finish. We are done.
25.08.2021 11:18
Neothehero wrote: Let $n>1$ be a positive integer. Each cell of an $n\times n$ table contains an integer. Suppose that the following conditions are satisfied: Each number in the table is congruent to $1$ modulo $n$. The sum of numbers in any row, as well as the sum of numbers in any column, is congruent to $n$ modulo $n^2$. Let $R_i$ be the product of the numbers in the $i^{\text{th}}$ row, and $C_j$ be the product of the number in the $j^{\text{th}}$ column. Prove that the sums $R_1+\hdots R_n$ and $C_1+\hdots C_n$ are congruent modulo $n^4$. Let $A_{i, j}$ be the entry in the $i^{\text{th}}$ row and $j^{\text{th}}$ column of the table. We observe that if $A_{i, j} = a_{i, j}n + 1$, then $$\prod\limits_{i=1}^n (1 + na_{i, j}) \equiv 1 + n(a_{1, j} + a_{2, j} \dots a_{n, j}) \equiv 1 \pmod{n^2}$$which is more or less consequence of taking the product of the terms in the sequence one by one and $\pmod{n^2}$ reducing them at each step until we have reduced the product of all steps one by one. Now, we see that $\prod\limits_{j=1}^n C_j = \prod\limits_{j=1}^n (1 + (C_j-1)) \equiv \sum\limits_{j=1}^n C_j - (n -1) \pmod{n^4}$ again by the similar method of step reduction of the product by multiplying the products one by one till they get reduced. This means that $$\sum\limits_{j=1}^n C_j = (n-1) + \prod\limits_{i = 1, j = 1}^n A_{i, j} \pmod{n^4}$$and we can do the same for the row sum too. Nice problem, took 30 min. Coming up with the product to sum idea could be hard and tricky but it is beautiful! Once you observe that and find what $c$ equals, where $c \equiv \sum R_i \equiv \sum C_j \pmod{n^4}$, then you will have an idea regarding what to do.
09.12.2021 08:28
Let each number be written in base $n$ mod $n^4$ as $(1, x_i, y_i, z_i)$. Then by expansion $\sum x_i$ in a column or row is $0$ mod $n$. Now $R_i = 1+\left(\sum x_i\right)n+\left(\sum_{i < j} x_ix_j+\sum y_i\right)n^2+\left(\sum_{i \neq j}x_iy_j +\sum z_i\right)n^3$ Notice if any term is a function of $x_i$ in the row, then it cancels in the congruence expansion since every square's function would be summed exactly once. Therefore we can reduce this to: $\left(\sum_{i < j} x_ix_j \right)n^2+\left(\sum_{i \neq j}x_iy_j\right)n^3$ Notice again that we can also add functions of $x_i$ in a row freely, so add $\left(\sum \frac{x_i^2}{2}\right)n^2 + \left(\sum x_iy_i\right)n^3$. This gives us $\frac{1}{2} \left(\sum x_i\right)^2n^2+\left(\sum x_i\right)\left(\sum y_i\right)n^3$ Note that $n \mid \sum x_i$, so the second term annihilates mod $n^4$. As for the left term, it can be $0$ or $\frac{n^4}{2}$. By parity of the $x_i$, $\frac{1}{2} \left(\sum x_i\right)^2n^2$ is $\frac{n^4}{2}$ the same parity of times in the sum of the $C_i$ as in the sum of the $R_i$ since it is equivalent to $\sum x_i$ being odd when fixed $n$ is even, so the first term also annihilates mod $n^4$ and we are done.
05.01.2022 05:26
Black Magic. Walkthrough-ed by Evan Write each cell as $1+n\cdot a_{ij}$, note that the sum condition says that $\sum_{i=1}^n a_{ij}$ and $\sum_{j=1}^n a_{ij}$ are both divisible by $n$. Thus, \[R_k = \prod_{j=1}^n (1+na_{kj})\equiv 1 + n\cdot \sum_{j=1}^n a_{kj}\equiv 1 \pmod{n^2}\]Now, note that \[\prod_{i=1}^n \prod_{j=1}^n (1+n\cdot a_{ij}) = \prod_{k=1}^n (1+(R_k-1))\equiv 1+ \sum_{k=1}^n (R_k-1) = \sum_{k=1}^n R_k - (n-1) \pmod{n^4}\]Thus, $\sum_{k=1}^n R_k\equiv \prod_{i=1}^n \prod_{j=1}^n (1+n\cdot a_{ij}) + (n-1)\pmod{n^4}$, and this is clearly symmetric so it is also congruent to $\sum_{k=1}^n C_k \pmod{n^4}$ and we're done. $\blacksquare$.
21.04.2023 06:14
Let the number on the $i$th row and $j$th column be $f(i,j)\cdot n + 1$. Note that \[n\sum_{i=1}^{n}{f(i,j)} + n\equiv \sum_{i=1}^{n}{f(i,j)\cdot n + 1}\equiv n\pmod {n^2}\]so $f(1,j)+f(2,j)+\dots+f(n,j)\equiv f(i,1)+f(i,2)+\dots + f(i,n)\equiv 0\pmod n$. Note that by binomial theorem, \[R_i\equiv 1+n(f(i,1)+f(i,2)+\dots + f(i,n))\equiv 1\pmod n^2\]which means $n^2\mid R_i-1$. Note that then by binomial theorem again, \[R_1R_2\dots R_n\equiv \prod_{i=1}^{n}(1+(R_i-1))\equiv 1+(R_1-1)+(R_2-1)+\dots + (R_n-1)\pmod {n^4}\]However, note that $C_1C_2\dots C_n=R_1R_2\dots R_n$ so the sums $R_1+\dots + R_n$ and $C_1+\dots +C_n$ are also equivalent $\pmod {n^4}$.
28.12.2023 01:36
We quite literally just compute everything. Let the entry at $(i, j)$ modulo $n^4$ be equal to $a_{ij} n^3 + b_{ij} n^2 + c_{ij} n + 1$ where $0 \leq a_{ij}, b_{ij}, c_{ij} < n$. Then notice that the second condition is equivalent to $n \mid c_{i1}+c_{i2}+\cdots+c_{in}$ for each $i$ and equivalently for $j$. Now we compute $R_1+R_2+\cdots+R_n$ directly, deleting in the process any terms that are symmetric in $i$ and $j$ (as they also will appear in $C_1+C_2+\cdots+C_n$.) Write \begin{align*} \sum_{i=1}^n R_i &= \sum_{i=1}^n \prod_{j=1}^n (a_{ij}n^3+b_{ij}n^2+c_{ij} n + 1) \\ &\equiv \sum_{i=1}^n\left(\sum_{j=1}^n a_{ij} + \sum_{j_1 \neq j_2} b_{ij_1}c_{ij_2}\right) n^3 + \left(\sum_{j=1}^n b_{ij} + \sum_{j_1 < j_2} c_{ij_1}c_{ij_2}\right) n^2+\sum_{j=1}^n c_{ij} n + 1 \\ &\equiv \sum_{i=1}^n \left(\sum_{j_1 \neq j_2} b_{ij_1}c_{ij_2}\right) n^3 + \left(\sum_{j_1 < j_2} c_{ij_1}c_{ij_2}\right)n^2. \end{align*}Now notice that $$\sum_{i=1}^n \left(\sum_{j_1 < j_2} c_{ij_1}c_{ij_2}\right)n^2 = \sum_{i=1}^n \frac 12\left(\left(\sum_{j=1}^n c_{ij}\right)^2 - \sum_{j=1}^n c_{ij}^2\right)n^2 = \sum_{i=1}^n n^2\left(\sum_{j=1}^n c_{ij}^2\right) $$as $n^2 \mid (c_{i1}+c_{i2}+\cdots+c_{in})^2$; so this term disappears. Similarly, $$\sum_{i=1}^n \left(\sum_{j_1 \neq j_2} b_{ij_1}c_{ij_2}\right) n^3 = \sum_{i=1}^n \left(\sum_{j=1}^n b_{ij}\right)\left(\sum_{j=1}^n c_{ij}\right) n^3 - n^3\sum_{j=1}^n b_{ij}c_{ij}.$$The second term disappears by symmetry, and the first term is a multiple of $n^4$. Thus everything disappears and the two sums are indeed congruent.
22.04.2024 09:09
Might be a fakesolve hidden amongst all the sums Let $a_{ij}$ denote the result when the integer in the $i$th row and $j$th column is divided by $n$ and rounded down. So, we are given $\sum_{i=1}^n a_{ij} \equiv 0 \pmod{n}$ for all $j$ and $\sum_{j=1}^n a_{ij} \equiv 0 \pmod{n}$ for all $i$. We wish to show that \[\sum_{i=1}^n \prod_{j=1}^n \left( na_{ij} + 1 \right) \equiv \sum_{j=1}^n \prod_{i=1}^n \left( na_{ij} + 1 \right) \pmod{n^4}.\]In this equation, the only terms which don't obviously cancel out are the degree $2$ and $3$ terms; we will show, in fact, that the sum of the degree $2$ terms on each side are equal, and that the sum of the degree $3$ terms on each side are equal: We evaluate the sum of the degree $2$ terms on the LHS modulo $n^4$: \begin{align*} & n^2 \sum_{i=1}^n \sum_{x,y} a_{ix} \cdot a_{iy} \\ \equiv ~ & n^2 \sum_{i=1}^n \frac{\left( \sum_{j=1}^n a_{ij} \right)^2 - \sum_{j=1}^n \left( a_{ij} \right)^2}{2} \\ \equiv ~ & \frac{n^2 \sum_{i=1}^n \left( \sum_{j=1}^n a_{ij} \right)^2}{2} - \frac{n^2 \sum_{i=1}^n \sum_{j=1}^n \left( a_{ij} \right)^2}{2}. \end{align*}The right term will also appear on the RHS, and thus cancels out; the left term is $\tfrac{n^4}{2}$ for both the LHS and RHS if the sum of all the integers in the grid is odd; otherwise, it is $n^4$ for both the LHS and RHS. Either way, the left term also cancels out. The degree $3$ terms on the LHS sum to: \[n^3 \sum_{i=1}^n \sum_{x,y,z} a_{ix} \cdot a_{iy} \cdot a_{iz}.\]We can reduce $\sum_{x,y,z} a_{ix} \cdot a_{iy} \cdot a_{iz}$ modulo $n$: \begin{align*} & \sum_{x,y,z} a_{ix} \cdot a_{iy} \cdot a_{iz} \\ \equiv ~ & \frac{\left( \sum_{j=1}^n a_{ij} \right) \left( \sum_{x,y} a_{ix} a_{iy} - \sum_{j=1}^n a_{ij}^2 \right) + \sum_{j=1}^n a_{ij}^3}{3} \\ \equiv ~ & \frac{\sum_{j=1}^n a_{ij}^3}{3}. \end{align*}So, the sum of the degree $3$ terms on the LHS, taken modulo $n^4$, is \[n^3 \cdot \frac{ \sum_{i=1}^n \sum_{j=1}^n a_{ij}^3}{3}, \]which will clearly cancel out with the RHS.
25.04.2024 02:32
smh... i am probably not marking this since i found the dumb solution
24.08.2024 06:40
Very very long and bashy. Didin't enjoy this at all. My solution didn't have any $\gcd(n,6)$ related issues like some others, so I hope this actually works. It's actually the same as #6 above. Let $A_{ij}$ denote the number written in cell $(i,j)$. Further, for all $1\le i,j \le n$ let $A_{ij}=nB_{ij}+1$ since we are given that each number is $1 \pmod{n}$. Now, we look at what we wish to show. First, \[\sum_{i+1}^n R_i \equiv n^3 \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr} + n^2 \sum_{k=1}^n \sum_{1\le p <q\le n}B_{kp}B_{kq} + n \sum_{k=1}^n \sum_{p=1}^n B_{kp} + n \pmod{n^4} \]and similarly, \[\sum_{i+1}^n C_i \equiv n^3 \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{pk}B_{qk}B_{rk} + n^2 \sum_{k=1}^n \sum_{1\le p <q\le n}B_{pk}B_{qk} + n \sum_{k=1}^n \sum_{p=1}^n B_{pk} + n \pmod{n^4} \]It is not hard to see that, $\sum_{k=1}^n \sum_{p=1}^n B_{kp} = \sum_{k=1}^n \sum_{p=1}^n B_{pk}$, so the desired conclusion is equivalent to \begin{align*} n^3 \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr} & + n^2 \sum_{k=1}^n \sum_{1\le p <q\le n}B_{kp}B_{kq}\\ &\equiv n^3 \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{pk}B_{qk}B_{rk} + n^2 \sum_{k=1}^n \sum_{1\le p <q\le n}B_{pk}B_{qk} \pmod{n^4}\\ n \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr} &+ \sum_{k=1}^n \sum_{1\le p <q\le n}B_{kp}B_{kq} \\ &\equiv n \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{pk}B_{qk}B_{rk} + \sum_{k=1}^n \sum_{1\le p <q\le n}B_{pk}B_{qk} \pmod{n^2} \end{align*}But, we can also note that, \begin{align*} \sum_{k=1}^n \sum_{1\le p <q\le n}B_{kp}B_{kq} &= \frac{ \sum_{k=1}^n \left(\sum_{i=1}^nB_{ki}\right)^2 - \sum_{k=1}^n \sum_{i=1}^nB_{ki}^2}{2}\\ & \equiv -\frac{\sum_{k=1}^n \sum_{i=1}^nB_{ki}^2}{2} \pmod{n^2} \end{align*}and similarly, \[\sum_{k=1}^n \sum_{1\le p <q\le n}B_{pk}B_{qk} \equiv -\frac{\sum_{k=1}^n \sum_{i=1}^nB_{ik}^2}{2} \pmod{n^2}\]but since $\sum_{k=1}^n \sum_{i=1}^nB_{ki}^2 = \sum_{k=1}^n \sum_{i=1}^nB_{ik}^2$ quite clearly, it follows that \[\sum_{k=1}^n \sum_{1\le p <q\le n}B_{kp}B_{kq} \equiv \sum_{k=1}^n \sum_{1\le p <q\le n}B_{pk}B_{qk} \pmod{n^2}\]Thus, we are left with showing, \[n \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr} \equiv n \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{pk}B_{qk}B_{rk} \pmod{n^2}\]\[\sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr} \equiv \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{pk}B_{qk}B_{rk} \pmod{n}\]But this is quite clear since, \begin{align*} \left(\sum_{p=1}^n B_{kp}\right )^3 &= \sum_{p=1}^n B_{kp}^3 + 3\sum_{1\le p\ne q \le n}B_{kp}^2B_{kq} + 6\sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr}\\ 0 & \equiv 3\left(\sum_{i=1}^n B_{ki}\right) \left(\sum_{j=1}^n B_{kj}^2\right) - 2\left(\sum_{l=1}^n B_{kl}^3\right ) + 6\sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr} \pmod{n}\\ \left(\sum_{i=1}^n B_{ki}^3\right ) & \equiv 3\sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr} \pmod{n} \end{align*}Thus, \[\sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr} \equiv \frac{\sum_{k=1}^n\left(\sum_{i=1}^n B_{ki}^3\right )}{3} \pmod{n}\]Similarly, \[\sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{pk}B_{qk}B_{rk} \equiv \frac{\sum_{k=1}^n \left(\sum_{i=1}^n B_{ik}^3\right )}{3} \pmod{n}\]from which since it is clear that $\sum_{k=1}^n\left(\sum_{i=1}^n B_{ki}^3\right )= \sum_{k=1}^n \left(\sum_{i=1}^n B_{ik}^3\right )$ it follows that \[\sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{kp}B_{kq}B_{kr} \equiv \sum_{k=1}^n \sum_{1\le p<q<r\le n}B_{pk}B_{qk}B_{rk} \pmod{n}\]which is what we desired.
06.12.2024 22:57
Let \(na_{ij}+1\) be the number in the \(i\)-th row and \(j\)-th column of the table. Observe that \[ R_i \equiv n \left(a_{i1} + a_{i2} + \cdots + a_{in} \right) + 1 \equiv 1 \pmod{n^2}. \]Thus, we can write \(R_i = n^2X_i + 1\). It follows that \[ \prod_{i=1}^n R_i = n^2 \left(X_1 + X_2 + \cdots + X_n \right) + 1 \equiv \sum_{i=1}^n R_i - (n-1) \pmod{n^4}. \]Similarly, \[ \prod_{i=1}^n C_i \equiv \sum_{i=1}^n C_i - (n-1) \pmod{n^4}. \]Since \(R_1R_2 \cdots R_n = C_1C_2 \cdots C_n\), we conclude that \[ R_1 + R_2 + \cdots + R_n = C_1 + C_2 + \cdots + C_n \pmod{n^4}. \]
22.12.2024 20:56
if it works it works Important change to a conventional definition: $a\equiv b\pmod{m}$ simply means $\frac{a-b}{m}\in \mathbb{Z}$. (Actually, this definition is also wrong, but it should clear up certain parts of the writeup---it's wrong because I also use fractions and modulo together at some point.) Write each number in the table as $na_{xy}+1$, where $x$ is the row number and $y$ is the column number. The second condition implies that the sum of all $a_{xy}$ in any row and in any column is $0$ modulo $n$. Let's focus on only $R_1$, keeping in mind the general context of summation over all rows---and then checking for congruence with the corresponding column sum. Here, we get: \[R_1=(na_{11}+1)\dots(na_{1n}+1)\equiv n^3\sum{a_{11}a_{12}a_{13}}+n^2\sum{a_{11}a_{12}}+n\sum{a_{11}}+1\pmod{n^4}.\]The third and fourth terms are constant when summed over all rows. Hence they can be deleted, and it suffices to show the following: if \[R'_1:=n\sum{a_{11}a_{12}a_{13}}+\sum{a_{11}a_{12}}\]then $R'_1+\dots+R'_n\equiv C'_1+\dots+C'_n\pmod{n^2}$. We can split the sum $R'_1$ into the two separate terms, and prove each part separately. Let's start with $\sum{a_{11}a_{12}}$. We may write (for $R'_1$ only), that: \[\sum{a_{11}a_{12}}=\frac{1}{2}\left[\left(\sum{a_{11}}\right)^2-\sum{a_{11}^2}\right].\]The second term is constant when summing over all rows, and may be deleted. Hence (and now we will expand), it suffices to show the following: \[\frac{1}{2}\left[(a_{11}+\dots+a_{1n})^2+\dots+(a_{n1}+\dots+a_{nn})^2\right]\equiv \frac{1}{2}\left[(a_{11}+\dots+a_{n1})^2+\dots+(a_{1n}+\dots+a_{nn})^2\right]\pmod{n^2}.\] From the bolded statement in the first section, we may split into two cases: If $n$ is odd: Then each individual term is $0$ modulo $n^2$, and dividing by $2$ has no effect. Hence we obtain $0\equiv 0\pmod{n^2}$, which is true. If $n$ is even: Write $n=2^em$. Evidently, modulo $m^2$, the same holds: we have $0\equiv 0\pmod{m^2}$. Now we must consider the $\nu_2$ of the sums that are being halved. In particular, define the following: \[X:=\left[(a_{11}+\dots+a_{1n})^2+\dots+(a_{n1}+\dots+a_{nn})^2\right]-\left[(a_{11}+\dots+a_{n1})^2+\dots+(a_{1n}+\dots+a_{nn})^2\right]\]and we must have $\nu_2(X)\ge 2e+1$. Assume for contradiction that $\nu_2(X)=2e$, and assume WLOG that the first term in the difference has $\nu_2$ equal to $2e$, while the other term has $\nu_2$ greater than $2e$. In the first term's $n$ summands, there are an odd number of summands with $\nu_2$ equal to $2e$, and so there exist an odd number of unsquared summands with $\nu_2$ equal to $e$. In other words, the sum $S$ of all numbers $a_{xy}$ has $\nu_2(S)=e$. Repeat the argument with the second term---there are an even number of unsquared summands with $\nu_2$ equal to $e$, and thus the sum $S$ of all numbers $a_{xy}$ has $\nu_2(S)>e$, a contradiction. At this point, there is one term left in the original sum for $R'_1$. Now consider the term $n\sum{a_{11}a_{12}a_{13}}$. Reduce to summing only $\sum{a_{11}a_{12}a_{13}}$ modulo $n$, and now write (through seemingly complex, but basic algebraic manipulation): \[\sum{a_{11}a_{12}a_{13}}=-\frac{1}{3}\left[\left(\sum{a_{11}}\right)^3-\sum{a_{11}^3}-3\left(\sum{a_{11}a_{12}}\right)\left(\sum{a_{11}}\right)\right].\]The second out of the three terms is constant when summed over all rows, and may be deleted. Then we obtain the expression \[-\frac{1}{3}\left(\sum{a_{11}}\right)^3+\left(\sum{a_{11}}{a_{12}}\right)\left(\sum{a_{11}}\right)\equiv -\frac{1}{3}\left(\sum{a_{11}}\right)^3\pmod n.\]We are almost done. If $3\nmid n$, then one finds \[-\frac{1}{3}\left(\sum{a_{11}}\right)^3\equiv 0\pmod n\]which evidently solves the problem. If $3\mid n$, then write $n=3m$. Note that $-\frac{1}{3}n^3$ divides the expression $-\frac{1}{3}\left(\sum{a_{11}}\right)^3$. We have \[n=3m\mid -9m^3=-\frac{1}{3}n^3\]hence $n$ divides $-\frac{1}{3}\left(\sum{a_{11}}\right)^3$. We are done. $\blacksquare$