Maths Olympiad Prep

Library / /1 of 43

Combinatorics Difficulty 7.0 National olympiad, round 2 Find the answer

Let pp be a prime number. A flea is staying at point 0 of the real line. At each minute, the flea has three possibilities: to stay at its position, or to move by 1 to the left or to the right. After p1p-1 minutes, it wants to be at 0 again. Denote by f(p)f(p) the number of its strategies to do this (for example, f(3)=3f(3)=3 : it may either stay at 0 for the entire time, or go to the left and then to the right, or go to the right and then to the left). Find f(p)f(p) modulo pp.

A number or a short expression. Spacing and $ signs are ignored.

Solution

Solution 1. The answer is f(p)0mod3f(p) \equiv 0 \bmod 3 for p=3,f(p)1mod3p=3, f(p) \equiv 1 \bmod 3 for p=3k+1p=3 k+1, and f(p)1mod3f(p) \equiv-1 \bmod 3 for p=3k1p=3 k-1. The case p=3p=3 is already considered, let further p3p \neq 3. For a residue ii modulo pp denote by ai(k)a_{i}(k) the number of Flea strategies for which she is at position ii modulo pp after kk minutes. Then f(p)=a0(p1)f(p)=a_{0}(p-1). The natural recurrence is ai(k+1)=ai1(k)+ai(k)+ai+1(k)a_{i}(k+1)=a_{i-1}(k)+a_{i}(k)+a_{i+1}(k), where the indices are taken modulo pp. The idea is that modulo pp we have a0(p)3a_{0}(p) \equiv 3 and ai(p)0a_{i}(p) \equiv 0. Indeed, for all strategies for pp minutes for which not all pp actions are the same, we may cyclically shift the actions, and so we partition such strategies onto groups by pp strategies which result with the same ii. Remaining three strategies correspond to i=0i=0. Thus, if we denote xi=ai(p1)x_{i}=a_{i}(p-1), we get a system of equations x1+x0+x1=3,xi1+xi+xi+1=0x_{-1}+x_{0}+x_{1}=3, x_{i-1}+x_{i}+x_{i+1}=0 for all i=1,,p1i=1, \ldots, p-1. It is not hard to solve this system (using the 3 -periodicity, for example). For p=3k+1p=3 k+1 we get (x0,x1,,xp1)=(1,1,2,1,1,2,,1)\left(x_{0}, x_{1}, \ldots, x_{p-1}\right)=(1,1,-2,1,1,-2, \ldots, 1), and (x0,x1,,xp1)=(1,2,1,1,2,,2)\left(x_{0}, x_{1}, \ldots, x_{p-1}\right)=(-1,2,-1,-1,2, \ldots, 2) for p=3k+2p=3 k+2. Solution 2. Note that f(p)f(p) is the constant term of the Laurent polynomial (x+1+1/x)p1(x+1+1 / x)^{p-1} (the moves to right, to left and staying are in natural correspondence with x,1/xx, 1 / x and 1.) Thus, working with power series over Fp\mathbb{F}_{p} we get (using the notation [xk]P(x)\left[x^{k}\right] P(x) for the coefficient of xkx^{k} in PP ) f(p)=[xp1](1+x+x2)p1=[xp1](1x3)p1(1x)1p=[xp1](1x3)p(1x)p(1x3)1(1x) =[xp1](1x3p)(1xp)1(1x3)1(1x)=[xp1](1x3)1(1x)\begin{aligned} f(p)=\left[x^{p-1}\right]\left(1+x+x^{2}\right)^{p-1} & =\left[x^{p-1}\right]\left(1-x^{3}\right)^{p-1}(1-x)^{1-p}=\left[x^{p-1}\right]\left(1-x^{3}\right)^{p}(1-x)^{-p}\left(1-x^{3}\right)^{-1}(1-x) \ = & {\left[x^{p-1}\right]\left(1-x^{3 p}\right)\left(1-x^{p}\right)^{-1}\left(1-x^{3}\right)^{-1}(1-x)=\left[x^{p-1}\right]\left(1-x^{3}\right)^{-1}(1-x) } \end{aligned} and expanding (1x3)1=x3k\left(1-x^{3}\right)^{-1}=\sum x^{3 k} we get the answer.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement and solution reproduced as published; topic and difficulty added by this site.