1. The problem statement, all variables and given/known data For any positive integer d and n, find the first integer d such that a^d =1 mod n 2. Relevant equations Euler's totient function phi(n) = # of #s relatively prime to n Will solve the condition if a and n are coprime but not for the first d 3. The attempt at a solution If a and n are not coprime then there is no solution. I am not sure how to find the smallest d such the condition holds. I know that d will be a factor of Euler's totient function.