Try using binary exponentiation. I mean:
111 * 111 = 111 ^ 2, now you know what 111 ^ 2 is, now you can calculate 111 ^ 4 by doing (111 ^ 2) * (111 ^ 2). Here is the whole sequence (note that this is probably not the most efficient way).
111 * 111 = 111^2 111^2 * 111^2 = 111^4 111^4 * 111^4 = 111^8 111^8 * 111^8 = 111^16 111^16 * 111^16 = 111^32 111^32 * 111^32 = 111^64 111^64 * 111^32 = 111^96 111^96 * 111^16 = 111^112 111^112 * 111^8 = 111^120 111^120 * 111^2 * 111^1 = 111^123.
source share