Euler's Theorem – Auto Solver

Theory
If gcd(a, n) = 1 → aφ(n) ≡ 1 (mod n)
For ak (mod n): reduce k using k mod φ(n)
Example: a = 5, k = 392, n = 13 → your class test question.
Step 1 – φ(n) and gcd(a, n)
Step 2 – Reduce exponent using φ(n)
Step 3 – Final result