Hey everyone I was wondering if anybody could help me with this problem.

Let G = <x> where x has order n and let r denote a positive integer. Prove that

generates G if and only if gcd(r,n) = 1, i.e. r and n are coprime.

I guess I am trying to prove the statement

.

When I try to do this however I just get a strange result... I would appreciate any guidance with this to see where I have gone wrong or what I can do to solve it.

Proof (<=)

such that

So

since |x| = n.

Also

since |x| = n.

Hence

giving

which of course means

.

Is this right, have I done something wrong?? Any help would be appreciated.