Solution. Those pairs are all pairs (c,d) of positive integers greater than 1 such that d≤c.
Assume first that d≥c+1. Choose a large prime p (we need p>2c2+c ) congruent to 1 modulo d (such a prime exists, by a particular case of Dirichlet's theorem; this particular case is easier to prove by using the cyclotomic polynomial Φd). Let Q(X)=Xd. Since d∣p−1, exactly 1+(p−1)/d residues modulo p are d-th powers; all other (d−1)(p−1)/d residue classes contain no values of P. Hence, if a set S satisfies the requirements, it should contain representatives of all those classes. But this is more than S is allowed to contain, since
dd−1(p−1)>2c+12c−1p⟸c+1c(p−1)>2c+12c−1p⟸(c+1)(2c+1)p>c+1c⟸p>c(2c+1).
We now show that such set S exists, whenever d≤c. To this end, usage is made of the lemma below.
Lemma. Fix an integer d≥2. Let G=(V,E) be a directed graph, each vertex of which has exactly one outgoing edge and at most d incoming edges. Assume further that there are at most d loops in this graph. Then there exists a subset V′ of V of cardinality ∣V′∣≤1+dd−1∣V∣ such that every vertex in V\V′ is the terminus of a directed path emanating from V′.
Proof. Consider any (weak) connected component G1=(V1,E1) in G - i.e., a component of the corresponding undirected graph. Since from each vertex emanates exactly one edge, the component contains a directed cycle (possibly a loop); and since the numbers of vertices and edges in G1 are equal, even an undirected cycle is unique. Hence, the component is a cycle with some trees rooting out of its vertices. With reference again to uniqueness of outgoing edges, the edges of these trees are all directed towards the cycle.
!
Now, let V′ choose exactly one vertex from each component that is just a cycle; for any other component, let V′ choose all its in-degree 0 vertices, i.e., the leaves of all trees rooting out of the vertices of the core-cycle - any vertex of such a tree can be reached from some leaf, and hence so can any vertex of the core-cycle.
To bound ∣V′∣ from above, let t be the number of single-vertex components in G, and notice that t≤d, since there are at most d loops in the graph. From each other component that is a cycle, V′ chooses at most half of its vertices, so at most dd−1-th part of them. Finally, consider a component containing some trees. Since each in-degree is at most d, at least d1-th part of the vertices have incoming edges, hence V′ chooses at most dd−1-th part of the vertices. Consequently,
∣V′∣≤t+dd−1(∣V∣−t)=dt+dd−1∣V∣≤1+dd−1∣V∣
as desired. This establishes the lemma.
Now let p and Q be chosen as in the problem statement. Consider a graph with vertex set Zp. Regard Q as a polynomial over Zp, and draw an edge a→Q(a) for every a in Zp. Since degQ=d, each b in Zp has at most d preimages, so the in-degree of each vertex is at most d. Since Q is monic and d>1, the equation Q(x)=x has at most d roots in Zp, hence the graph has at most d loops. Thus, implementation of the lemma provides a set V′ which is suitable as the required set S. Indeed, the lemma statement shows that each residue is a repetitive image of some element of S; and the implications below show that the cardinality of V′ lies within the required range:
∣V′∣≤dd−1p+1≤2c+12c−1p⟸cc−1p+1≤2c+12c−1p⟸c(2c+1)p≥1⟸p≥c(2c+1)