Solution 1. Let Ai,j be the entry in the ith row and the jth column; let P be the product of all n2 entries. For convenience, denote ai,j=Ai,j−1 and ri=Ri−1. We show that
i=1∑nRi≡(n−1)+P(modn4)
Due to symmetry of the problem conditions, the sum of all the Cj is also congruent to (n−1)+P modulo n4, whence the conclusion.
By condition (i), the number n divides ai,j for all i and j. So, every product of at least two of the ai,j is divisible by n2, hence
Ri=j=1∏n(1+ai,j)=1+j=1∑nai,j+1⩽j1<j2⩽n∑ai,j1ai,j2+⋯≡1+j=1∑nai,j≡1−n+j=1∑nAi,j(modn2)
for every index i. Using condition (ii), we obtain Ri≡1(modn2), and so n2∣ri.
Therefore, every product of at least two of the ri is divisible by n4. Repeating the same argument, we obtain
P=i=1∏nRi=i=1∏n(1+ri)≡1+i=1∑nri(modn4)
whence
i=1∑nRi=n+i=1∑nri≡n+(P−1)(modn4)
as desired.
Comment. The original version of the problem statement contained also the condition
(iii) The product of all the numbers in the table is congruent to 1 modulo n4.
This condition appears to be superfluous, so it was omitted.
Solution 2. We present a more straightforward (though lengthier) way to establish (1). We also use the notation of ai,j.
By condition (i), all the ai,j are divisible by n. Therefore, we have
P=i=1∏nj=1∏n(1+ai,j)≡1+(i,j)∑ai,j+(i1,j1),(i2,j2)∑ai1,j1ai2,j2+(i1,j1),(i2,j2),(i3,j3)∑ai1,j1ai2,j2ai3,j3(modn4),
where the last two sums are taken over all unordered pairs/triples of pairwise different pairs (i,j); such conventions are applied throughout the solution.
Similarly,
i=1∑nRi=i=1∑nj=1∏n(1+ai,j)≡n+i∑j∑ai,j+i∑j1,j2∑ai,j1ai,j2+i∑j1,j2,j3∑ai,j1ai,j2ai,j3(modn4)
Therefore,
P+(n−1)−∑iRi≡∑(i1,j1),(i2,j2)i1=i2ai1,j1ai2,j2+∑(i1,j1),(i2,j2),(i3,j3)i1=i2=i3=i1ai1,j1ai2,j2ai3,j3+∑(i1,j1),(i2,j2),(i3,j3)i1=i2=i3ai1,j1ai2,j2ai3,j3(modn4).
We show that in fact each of the three sums appearing in the right-hand part of this congruence is divisible by n4; this yields (1). Denote those three sums by Σ1,Σ2, and Σ3 in order of appearance. Recall that by condition (ii) we have
j∑ai,j≡0(modn2) for all indices i.
For every two indices i1<i2 we have
j1∑j2∑ai1,j1ai2,j2=(j1∑ai1,j1)⋅(j2∑ai2,j2)≡0(modn4),
since each of the two factors is divisible by n2. Summing over all pairs (i1,i2) we obtain n4∣Σ1.
Similarly, for every three indices i1<i2<i3 we have
j1∑j2∑j3∑ai1,j1ai2,j2ai3,j3=(j1∑ai1,j1)⋅(j2∑ai2,j2)⋅(j3∑ai3,j3)
which is divisible even by n6. Hence n4∣Σ2.
Finally, for every indices i1=i2=i3 and j2<j3 we have
ai2,j2⋅ai2,j3⋅j1∑ai1,j1≡0(modn4),
since the three factors are divisible by n,n, and n2, respectively. Summing over all 4 -tuples of indices (i1,i2,j2,j3) we get n4∣Σ3.