# 2017 UNCO Math Contest II Problems/Problem 5

## Problem

Double Encryption


(a) Find a substitution code on the seven letters A, B, C, D, E, F, and G that has the property that if you apply it twice in a row (that is, encrypt the encryption), the message ABCDEFG becomes ECBFAGD. Describe your answer by giving the message that results when encryption is applied once to the message ABCDEFG.

(b) Find another such code, if there is one.

## Solution

We first notice that there are two 2-cycles, $A-E$ and $B-C$, and one 3-cycle, $D-F-G$ (in that order). From the single 3-cycle, we realize that $D \rightarrow G$, $G \rightarrow F$, and $F \rightarrow D$. We then figure that after two substitutions $B$ becomes $C$ and vice-versa, then there must be another 2-cycle that fills in the gaps (see figure below). $B \rightarrow \fullmoon \rightarrow C \rightarrow \fullmoon \rightarrow B \ldots \text{etc}$

But since there's only one other 2-cycle, $A-E$, either $A$ fills in the first gap and $E$ fills in the second, or $E$ fills in the first gap and $A$ fills in the second. This results in $CAEGBDF$ and $BEAGCDF$ respectively, so the answers are

(a) $\boxed{CAEGBDF}$

and

(b) $\boxed{BEAGCDF}$