Divisors in residue classes