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(mod n4)
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(mod n4).
Therefore,
P+(n−1)−i∑Ri≡(i1,j1),(i2,j2)i1=i2∑ai1,j1ai2,j2+(i1,j1),(i2,j2),(i3,j3)i1=i2=i3=i1∑ai1,j1ai2,j2ai3,j3+(i1,j1),(i2,j2),(i3,j3)i1=i2=i3∑ai1,j1ai2,j2ai3,j3(mod n4).
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(mod n2)for all indices i
For every two indices i1<i2 we have
j1∑j2∑ai1,j1ai2,j2=(j1∑ai1,j1)⋅(j2∑ai2,j2)≡0(mod n4)
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(mod n4)
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.