indices and ax^n congruent to b mod m

let a, b be integers such that gcd(a,m) = gcd(b,m) = 1, let n, m be positive integers, let g be a primitive root modulo m.

Find the necessary and sufficient condition on the index of a (mod m) (denoted I(a) ) and the index of b (mod m) (denoted I(b) ) for the congruence equation ax^n congruent to b (mod m) to have integer solutions.

I have:

ax^n congruent to b mod m iff

I(ax^n) = I(b), which is true iff

I(ax^n) congruent to I(b) mod (phi(m)) (Phi(m) refers to euler's phi function)

i.e. I(a) + nI(x) congruent to I(b) mod (phi(m))

i.e. nI(x) congruent to I(b) - I(a) mod (phi(m))

which has solutions iff gcd(n, phi(m)) divides ( I(b) - I(a) )

is this correct, or is there some further conclusion I can draw? Thanks!