## On the Subject of Cruel Modulo

Remember that super easy mathematical module? **Here’s his evil twin.**

- This modulo shows three numbers, a keypad, and a small screen at the bottom which will display the answer.
- Take the larger central number (n), raise it to the power of the smaller number in the top right (p), and then modulo this result by the smaller number in the top left (m).
- To perform the modulo operation, multiply n by itself p times, then take this number subtract m from it repeatedly until it is less than m.
- Alternatively, divide n^p by m and take the remainder.
- Whichever method you prefer to use, once you have calculated the correct answer, enter it into the keypad and press the green submit button. The module will only process if at least a digit is inputted.
- To clear your answer, press the red clear button.
- Entering the correct answer will disarm the module. Entering an incorrect answer will cause a strike and reset both m and n, but NOT p.

For an alternative method:

- Take n, modulo m.
- Let a variable, t, equals 1.
- Take the result, multiplied by n, modulo m.
- Add 1 to t.
- Repeat step 3 and 4 until t is equal to p, or the result got is the same as n modulo m.
- If t is equal to p, the result currently is the answer.
- If the result got is the same as n modulo m, take p, modulo t-1.
- If the result is 0, use t-1.
- List down the pattern, and label it from 1, then 2, 3, and so on.
- Take the result and find the label that is the same as the result found in step 7 and 8.
- The result found is your answer.