Group Theory idea: We make a Cayley diagram for the numbers less than n.
Example.
Say x=11. Follow the arrows from 1 to 11. This is one x14 arrow and two x2 arrows. If you do this 7 more times, you will be following a total of eight x14 arrows and sixteen x2 arrows, and you should end up at 11 to the eighth. However, eight x14 arrows and sixteen x2 arrows clearly ends you up back where you started! (Note that it doesn't matter in what order you follow the arrows....)
So how do we use the trap door?