Given $2018 \times 4$ grids and tint them with red and blue. So that each row and each column has the same number of red and blue grids, respectively. Suppose there're $M$ ways to tint the grids with the mentioned requirement. Determine $M \pmod {2018}$.
Problem
Source: 2018 CGMO Day 2 Problem 7
Tags: combinatorics, number theory, modular arithmetic
14.08.2018 11:01
so let us consider the 6 different ways of colouring the 1x4 grid such that the number of red and blue grids are equal. RRBB,RBRB,RBBR,BRRB,BRBR,BBRR. Let Bi be the number of these 1x4 grid (for i=1 to 4) (so for example the number of RRBB on this 2018x4 grid is B1). we know that B1+B2+B3=1009 since there has to be exactly 1009 Reds on the first column. B2+B4+B5=1009, B4+B6+B1=1009, and B3+B5+B6=1009 in the same way for the second, third and fourth column.Solving this we get B1=B5,B2=B6 and B3=B4 Let B1=a, B2=b, B3=c, B4=d,B5=e, B6=f then M= the sum of 2018!/a!b!c!d!e!f!. 2018=2x1009 and a+b+c=1009,d+e+f=1009 and so since 1009 is prime so unless one of a,b,c is 1009 and the other two 0, then 2018!/a!b!c!d!e!f!=0 (mod2018). The way of picking B1,B2,B3,B4,B5,B6 is 3H1009=1011C3 as if we pick B1,B2,B3, then B4,B5,B6 automatically follow. 1011C3-3=1006(mod2018) (the 3 is the 3 cases where two of B1,B2,B3 are 0) 2018!/a!b!c!d!e!f!=0 sum of (2018!/a!b!c!d!e!f!) =0(mod2018). Now we only have to find out 3x (2018!/1009!1009!) in (mod2018). By wilson's theorem this is -6 (mod1009) but since it is also 0(mod2) the answer seems to be 2012 (mod2018)
15.08.2018 16:46
For most colorings, cyclic permutations of all 2018 rows give 2018 different colorings. This leaves those colorings whose cyclic permutations of all 2018 rows give fewer than 2018 different colorings, which means the rows are periodic, the only instance being 1009 identical 2*4 grids stacked together. Therefore, M (mod 2018) is the number of ways to fill such a 2*4 grid, which is 6.
18.09.2018 13:34
Let each column be $C_{1},C_{2},...,C_{2018}$. For each $C_{i}$, The combination of the number of blue and red could be $(4,0),(3,1),(2,2),(1,3),(0,4)$. In case of every $C_{i}=(4,0) or (0,4)$, The Sum of the number of way to tint is $2$. When $C_{i}=(3,1) or (1,3)$, There is no way to tint, because $3,1$ is odd. Now we should count the way to tint when every $C_{i}=(2,2)$. In this case, each row can be colored such as $(R,R,B,B),(R,B,R,B),(R,B,B,R),(B,R,R,B),(B,R,B,R),(B,B,R,R)$ Now considering $R=1, B=-1$, we can get generating function $f(x,y,z)=(x+y+z+\frac{1}{x}+\frac{1}{y}+\frac{1}{z})^{2018}$, The ways of coloring equals constant term $C$ in this function. $C=\sum_{k+l+m=1009}\frac{2018!}{(k!)^{2}(l!)^{2}(m!)^{2}}\equiv3\binom{2018}{1009}\equiv6\pmod{1009}$ So $C\equiv6\pmod{2018}$