I'm supposed to prove that for any integer using Euler's theorem. I'm trying to first prove it under the assumption that , which allows me to apply Euler's theorem. In this case, I showed that . What I want to do is get from here to so I can multiply both sides by and get the result. However, I'm not sure how to fill in that gap. Is there some theorem I can use? Or am I going about this in the wrong way?

Also, I'm not sure how to handle the case where a and 1729 are not relatively prime. Any help there would be appreciated as well.