On the distribution of the order and index of g(mod p) over residue classes