Project Euler 122 - Efficient Exponentiation

Official link: https://projecteuler.net/problem=122