Skip to main content
OlympiadHQ

Browse · MathNet

Print

China Mathematical Competition (Complementary Test)

China counting and probability

Problem

The code setting of a cipher lock is established on an -regular-polygon with vertices : each vertex is assigned a number (0 or 1) and a color (red or blue), such that either the numbers or the colors on each pair of adjacent vertices are the same. We ask: How many code-sets can be realized for this lock?
Solution
Given an arbitrary code-set for the lock, if two adjacent vertices have different numbers, we label the sides linking them by letter ; if they have different colors, we label it by ; if both the numbers and colors are the same, we label it by . Once the number and color on vertex are set (there are four different sets for it), we can then set one by one according to the letters labelled on each side. In order to let it return to the initial set of finally, the numbers of sides labelled and must be both even. So the number of code-sets for the lock is four times the number of labelled-side sequences which satisfy the condition that the numbers of sides labelled by and are both even.

Suppose there are () sides labelled by , and () sides labelled by . Then there are ways to label sides by from ones, ways to label sides by from ones, and the remaining sides are labelled by . Therefore, by the Multiplication Principle, there are ways to label all the sides. So there are totally code-sets for the lock. Here we stipulate .

When is odd, we have , and then Substituting it into the previous formula, we get

When is even, if , then the above remains true; if , then all the sides of the polygon are labelled by , and that means there is only one way to label the sides. Therefore, there are totally code-sets for the lock.

In summary, the number of code-sets for the lock is
Final answer
Odd n: 3^n + 1; Even n: 3^n + 3

Techniques

Recursion, bijectionInvariants / monovariantsAlgebraic properties of binomial coefficients