On the parity of k-th powers modulo p. A generalization of a problem of Lehmer