# Order of letters on 3-rd rotor: Enigma III

In the photo you can see the three Enigma's rotors.

On the 1-st rotor (marked with number 50 on the photo) letters put on clockwise. On the 2-nd rotor letters put on counterclockwise.

Question. What is an order rule on the 3-rd rotor?

Edit. After the Maarten Bodewes comment, I have tried Number mod 1 and Number mod 2:

Edit2. On the second side of the 1-st rotor (marked with number 51 on the photo) letters put on clockwise.

• One-oh-two-mod-three. Jan 23, 2018 at 1:03
• @MaartenBodewes, thank for the comment. Could you please write the formulа?
– Nick
Jan 23, 2018 at 4:01
• Try =CHR(64+A1+MOD(A1+2,3)) with A1 from 0 to 25. This Enigma III is to the real thing what a paper airplane is to the one built by the Wright brothers.
– fgrieu
Jan 23, 2018 at 8:39
• Hmm, note that the arrow is to the right hand side on the right wheel. Jan 23, 2018 at 8:51

OK, so first you need to index the alphabet. So let's say that A=0 and Z=25 - a zero based index - as we need to perform modular arithmetic.

Lets reference the letters of the first wheel with index $i_1$ and the letters of the second wheel $i_2$. Then $i_2$is simply $i_1+20 \mod 26$. Note that the second wheel moves in the other direction as the first wheel, but that the alphabet is reversed to counter clockwise.

The third wheel has a repeating pattern of three characters: "BAC EDF ...". Here the arrow is to the side. The letters are now clockwise again.

Let's simplify the third wheel so that A is converted to B, B becomes A and C stays C. So index 0 becomes 1, index 1 becomes 0 and index 2 stays 2. The offset from the start of each set of three characters can then be written as $k_3 = (-j_3 + 1) \bmod 3$ for all mappings. To calculate the offset in the simplified wheel we have to add the start of the set: $l_3 = \lfloor j_3 / 3 \rfloor \cdot 3$.

Finally, we should undo the given simplification: a quick check will find that the alphabet has shifted 16 characters.

So the answer becomes $$i_3 = k_3 + l_3 = (-j_3 + 1) \bmod 3 + \lfloor j_3 / 3 \rfloor \cdot 3 \mod 26$$ where $$j_3 = i_2 + 16 \mod 26$$

Obviously it is much easier to simply write down which character comes up at the other wheel for each character of the alphabet. Then you only need to shift up to 25 places for each setting of the wheel.

Note that it is possible to change the order of the wheels and how the wheels are positions in relation to each other. If these changes could not be made it would be easy simply to change the to right hand wheels with a single wheel (which would have the same formula as wheel 3, but with constant 10 as $20 + 16 \bmod 26 = 10$).