Maths Olympiad Prep

Library / /19 of 37

Combinatorics Difficulty 8.0 Shortlist Find the answer

Assume nn is a positive integer. Considers sequences a0,a1,,ana_0, a_1, \ldots, a_n for which ai{1,2,,n}a_i \in \{1, 2, \ldots , n\} for all ii and an=a0a_n = a_0.

(a) Suppose nn is odd. Find the number of such sequences if aiai1≢i(modn)a_i - a_{i-1} \not \equiv i \pmod{n} for all i=1,2,,ni = 1, 2, \ldots, n.

(b) Suppose nn is an odd prime. Find the number of such sequences if aiai1≢i,2i(modn)a_i - a_{i-1} \not \equiv i, 2i \pmod{n} for all i=1,2,,ni = 1, 2, \ldots, n.

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

Solution

Let n n be a positive integer. Consider sequences a0,a1,,an a_0, a_1, \ldots, a_n for which ai{1,2,,n} a_i \in \{1, 2, \ldots , n\} for all i i and an=a0 a_n = a_0 .

### Part (a)
Suppose n n is odd. We need to find the number of such sequences if aiai1≢i(modn) a_i - a_{i-1} \not\equiv i \pmod{n} for all i=1,2,,n i = 1, 2, \ldots, n .

Using the principle of inclusion-exclusion, we start by considering the number of ways to choose k k of the conditions to be disregarded. There are (nk) \binom{n}{k} ways to choose k k conditions. Each condition synchronizes two neighboring entries in the sequence, resulting in nk n-k groups of entries that move together. There are nnk n^{n-k} possibilities for these groups.

For k=n k = n , we must have 1+2++n=n(n+1)20(modn) 1 + 2 + \dots + n = \frac{n(n+1)}{2} \equiv 0 \pmod{n} , which is true for odd n n . There are n n possibilities in this case.

Thus, the number of sequences is given by:
k=0n(1)k(nk)nnk(n1). \sum_{k=0}^{n} (-1)^k \binom{n}{k} n^{n-k} - (n-1).

Using the binomial theorem, this simplifies to:
(n1)n(n1). (n-1)^n - (n-1).

### Part (b)
Suppose n n is an odd prime. We need to find the number of such sequences if aiai1≢i,2i(modn) a_i - a_{i-1} \not\equiv i, 2i \pmod{n} for all i=1,2,,n i = 1, 2, \ldots, n .

We extend the previous method by choosing k k places where we disregard the condition, but now we have two possibilities for each place. The condition for i=n i = n counts as one condition, so we need two terms for each k k to distinguish whether i=n i = n is involved or not.

For k<n k < n , the sum is:
k=0n1((1)k(n1k)2knnk+(1)k(n1k1)2k1nnk). \sum_{k=0}^{n-1} \left( (-1)^k \binom{n-1}{k} 2^k n^{n-k} + (-1)^k \binom{n-1}{k-1} 2^{k-1} n^{n-k} \right).

This simplifies to:
n(n2)n1(n2)n1=(n1)(n2)n1. n(n-2)^{n-1} - (n-2)^{n-1} = (n-1)(n-2)^{n-1}.

For k=n k = n , we need to find the number of ways to choose ϵi{1,2} \epsilon_i \in \{1, 2\} such that i=1nϵii0(modn) \sum_{i=1}^{n} \epsilon_i i \equiv 0 \pmod{n} . Since n n is odd, this reduces to finding subsets S S of {1,2,,n} \{1, 2, \ldots, n\} with xSx0(modn) \sum_{x \in S} x \equiv 0 \pmod{n} . This is true if S S contains all or none of the elements. For other sets, we consider shifts of S S by adding i i to each entry of S S . Since n n is prime, the sequence of shifted sets has period n n , and we get each residue mod n n exactly once.

Thus, there are 2+2n2n 2 + \frac{2^n - 2}{n} such sets. Dividing by two (since ϵn \epsilon_n is the same in both cases), we get:
2+2n2n2=1+2n11n. \frac{2 + \frac{2^n - 2}{n}}{2} = 1 + \frac{2^{n-1} - 1}{n}.

Therefore, the number of sequences is:
(n1)(n2)n1(1+2n11n). (n-1)(n-2)^{n-1} - \left( 1 + \frac{2^{n-1} - 1}{n} \right).

The answer is:
(n1)(n2)n12n11n1. \boxed{(n-1)(n-2)^{n-1} - \frac{2^{n-1} - 1}{n} - 1}.

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.