# First time a^d = 1 mod n

## Homework Statement

For any positive integer d and n, find the first integer d such that a^d =1 mod n

## Homework 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

## 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.

Last edited by a moderator:

## Answers and Replies

BvU
Science Advisor
Homework Helper
For any positive integer d and n, find the first integer d such that a^d =1 mod n
Is d given or is d to be found ? Is a arbitrary ? Or would the exercise have been something along the lines of
For any positive integer a and n, find the first integer d such that a^d =1 mod n

d is to be found. Essentially I want to find the smallest integer d such that a^d = 1 mod n holds true.
Yes, For any positive integer a and n, find the first integer d such that a^d =1 mod n is how the problem should have been stated.