A tiling game and generating functions

Created
Contactpranav.joshi@iitgn.ac.in
CreatorPranav Joshi

Hi! This problem is a generalisation of a special case which Mathologer has a video on. This generalisation was presented in the ES214 course (Discrete Mathematics) conducted in 2023 at IITGN.

Claim

Given a sequence An=[a0  a1  a2an1]A_n = [a_0\;a_1\;a_2\dots a_{n-1}] , with indexing operation An[i]=aiA_n[i] = a_i, we generate the reduced sequence An1A_{n-1} as

An1[r]=(An[r]+An[r+1])modp    r{0,1n2} A_{n-1}[r] = -(A_n[r] + A_n[r+1]) \mod{p} \;\;\forall r \in \{0,1\dots n-2\}

for an odd prime pp .

I claim that if n=pk+1n = p^k + 1 for any whole number kk , then

A1[0]=(An[0]+An[n1])modp. A_1[0] = -(A_n[0] + A_n[n-1]) \mod{p} .
Simulation

Play around with this for a few times to get a feel.

The top row is the sequence AnA_n . You can also input arithmetic expressions for nn (For example, “3**2 + 1”) to get a randomly generated AnA_n .

Proof

Consider this function :

pm(x)=(a0+a1x+a2x2+)(1x1)m.p_m(x) = (a_0+a_1x+a_2x^2+\dots)(-\frac{1}{x}-1)^m .

The coefficients of non negative powers of xx in pm(x)p_m(x) give us the sequence AnmA_{n-m} . Basically, the coefficient of xnx^n in pm(x)p_m(x) is congruent, modulo pp, to the nthn^\text{th} entry in the sequence AnmA_{n-m} , namely Anm[n]A_{n-m}[n] . Stated compactly,

Coefficinet of xn in pm(x)Anm[n]modp\text{Coefficinet of }x^n \text{ in }p_m(x) \equiv A_{n-m}[n] \mod{p}

So to find A1[0]A_1[0] , we look for the coefficient of x0x^0 in pn1(x)p_{n-1}(x) , which can be equivalently stated as the coefficient of xn1x^{n-1} in the polynomial

(a0+a1x+a2x2+)(1x)n1(a_0+a_1x+a_2x^2+\dots)(-1-x)^{n-1}

, which can be rewritten as

(1)n1(a0+a1x+a2x2+)(r=0n1  n1Cr  xr).(-1)^{n-1}(a_0+a_1x+a_2x^2+\dots)(\sum_{r=0}^{n-1} \;^{n-1}C_r \;x^r) .

Thus, the coefficient of xn1x^{n-1} is :

(1)n1(a0  n1Cn1  +a1  n1Cn2  +a2  n1Cn3  ++an1  n1C0  ).(-1)^{n-1} (a_0 \;^{n-1}C_{n-1}\; + a_1 \;^{n-1}C_{n-2}\; + a_2 \;^{n-1}C_{n-3}\; + \dots + a_{n-1} \;^{n-1}C_{0}\;) .
Now, if n=pk+1n = p^k +1 ….

…then this expression is equivalent to

(1)pk(a0+an1)(-1)^{p^k}(a_0+a_{n-1})

, but modulo pp .

This is because

p    pkCr  r1,2,pk1p \;|\; ^{p^k}C_{r} \;\forall r\in {1,2,\dots p^k-1}

But since pp is odd, (1)pk(a0+an1)=(a0+an1) (-1)^{p^k}(a_0+a_{n-1}) = -(a_0 + a_{n-1}).

Thus, in summary, we have showed

A1[0](1)n1(a0  n1Cn1  +a1  n1Cn2  +a2  n1Cn3  ++an1  n1C0  )(a0+an1)modp if   kW   s.t.  n=pk+1A_1[0] \equiv \\ (-1)^{n-1} (a_0 \;^{n-1}C_{n-1}\; + a_1 \;^{n-1}C_{n-2}\; + a_2 \;^{n-1}C_{n-3}\; + \dots + a_{n-1} \;^{n-1}C_{0}\;) \\ \equiv -(a_0+a_{n-1}) \mod{p} \\\text{ if }\; \exists \,k \in \mathbb{W} \;\text{ s.t.}\;n=p^k+1
When n is not in the form required

Since n1n-1 is not a power of a prime pp, we can write it as n1=xpkn-1= xp^k where gcd(x,p)=1\gcd(x,p) = 1 and x>1x > 1 .

A useful (general) property

If pp is a prime and gcd(p,x)=1\gcd(p,x)=1, then xpkCpkxmodp^{xp^k}C_{p^k} \equiv x \mod{p}  .

Proof

We can split the problem of choosing from xpkx p^kxpkxp^kpkp^k  and write :

xpkCpk=r1+r2++rx=pk  pkCr1pkCr2pkCrx^{xp^k}C_{p^k} = \sum_{r_1+r_2+\dots+r_x = p^k }\;^{p^k}C_{r_1}^{p^k}C_{r_2}\dots^{p^k}C_{r_x}

Since p    pkCr    r{1,2,3pk1}p \;|\; ^{p^k}C_r \;\;\forall r \in \{1,2,3\dots p^k-1\} , thus we can write the following congruence (modulo pp) :

xpkCpk0+rj=pk;  ri=0  ij  pkCr1pkCr2pkCrx=1jx  1=x^{xp^k}C_{p^k} \equiv 0 + \sum_{r_j=p^k\,;\;r_i=0 \;\forall i\neq j}\;^{p^k}C_{r_1}^{p^k}C_{r_2}\dots^{p^k}C_{r_x} = \sum_{1\leq j\leq x}\;1 = x

Now, using this property, if we set an1pk=1a_{n-1-p^k} = 1 and all other ai=0a_i = 0 (including a0a_0, since x>1    n1pkx > 1 \implies {n-1} \neq p^k  and thus an1pka_{n-1-p^k} and a0a_0 are distinct coefficients), then we get :

A1[0](1)n1(a0  n1Cn1  +a1  n1Cn2  +a2  n1Cn3  ++an1  n1C0  )(1)n1(an1pk  xpkCpk+0)(1)n1(1x)modp.A_1[0] \equiv \\(-1)^{n-1} (a_0 \;^{n-1}C_{n-1}\; + a_1 \;^{n-1}C_{n-2}\; + a_2 \;^{n-1}C_{n-3}\; + \dots + a_{n-1} \;^{n-1}C_{0}\;) \\ \equiv (-1)^{n-1} (a_{n-1-p^k} \;^{xp^k}C_{p^k} + 0) \\\equiv (-1)^{n-1}(1\cdot x) \mod{p}.

But since pp  does not divide xx , this is not divisible by pp and. But since a0=an1=0a_0 = a_{n-1} = 0 , so,

(a0+an1)0modp-(a_0 + a_{n-1}) \equiv 0 \mod{p}

And thus we have :

A1[0](1)n1x≢(a0+an1)modpA_1[0] \equiv (-1)^{n-1}x \not\equiv -(a_0+a_{n-1}) \mod{p}

In conclusion, there exists an AnA_n , namely the one we constructed, such that the claim A1[0]=(An[0]+An[n1])modp A_1[0] = -(A_n[0] + A_n[n-1]) \mod{p}  doesn’t hold true, if and only if nn can’t be written as pk+1p^k + 1 for some kWk \in \mathbb{W} .