In a mathematics class, the teacher shows an apparatus containing switches, where each switch can be in any of three positions, labelled 1–3, and . Initially, all switches are in position 1, and we need to move the switches so that all are in position 2. The teacher shows one method of doing this that involves exactly steps, where each step changes the position of exactly one switch.
Let be the number of -step methods for altering the apparatus in this way, not including the teacher's method. Two methods are the same only if they involve the same steps in the same order. Show that has no factor satisfying , and that is a factor of if and only if is prime.
Solution
We provide three methods to show that for all .
(We omit the assumption when proving this.) Let , i.e.
is the number of -step methods including that of the teacher.
Method 1. Consider the first step of any -step method. If this involves moving some switch to position 2, we call it a Type A step. After we perform a Type A step on , we cannot subsequently move since we would later need to move it back again to position 2, thereby “wasting” two steps when we only have a single step to spare. Our only option therefore is to use the remaining steps to change the other switches from position 1 to position 2. This can be done in ways. Since there are choices for the initial switch , we get a total of methods that start with a Type A step.
Alternatively, if the first step moves a switch to position 3, we call it a Type B step. After a Type B step, all switches are in the wrong position, so each subsequent step must consist of changing a switch to position 2. Thus, the only choices involve the order in which we carry out these moves, giving a total of methods that start with the given Type B step. Since there are choices for the initial switch , there are methods that start with a Type B step.
Rewriting these equations in terms of , we get for
all , and . Thus, and . This
finishes the proof of our claim.
Method 2. First note that in each -step method, exactly one switch will first be switched to 3 and then to 2, whereas all others have to be switched to 2 directly. If we ignore this extra initial switching to 3, each -step method gives rise to an -step method, which is just an ordering of the switches; and there are of them.
For how many different -step methods do we get to the same -step
method (or ordering of switches)? The answer is , because the
switch which is the -th which is switched to 2 in the -step method, could be switched to 3 any time before it is switched to 2, and there are opportunities to do so. The conclusion is that .
Method 3. Exactly one switch has to be touched twice. If this is switch , then we are seeking the number of ways to permute the numbers
which is . Taking into account all values of yields a total of .
We now prove the divisibility statements about . Since is even for all , is an integer. Since by assumption, . (Of course, this is also clear in terms of the combinatorial meaning.) To show that is not divisible by any integer , it suffices to prove this under the additional assumption that is prime.
If is even, for any integer . If is odd, is even hence not prime. Thus, any prime that satisfies , is a factor of and so cannot divide .
It remains to consider divisibility by . If is not prime, then it has a prime factor less than . By the above, is not divisible by , and so it is not divisible by .
Suppose finally that is prime. By Wilson's theorem,
Since also , the equation implies that
and so , because . Thus, divides as required.