In Chapter II.10 of *The Map of My Life*, Goro Shimura mentions a certain problem:

The second topic concerns a polynomial $F(x)$ with integer coefficients. Take $$ F(x) = x^3 + x^2 - 2x - 1, $$ for example. For an integer $n$, we consider the decomposition of $F(n)$ into the product of prime numbers. We can allow $n$ to be negative, but let us assume $n$ to be positive here. Thus $$ F(1) = -1, F(2) = 7, F(3) = 29, F(4) = 71, F(5) = 139, $$ $$ F(6) = 239, F(7) = 13 \cdot 29, F(8) = 13 \cdot 43, F(9) = 7 \cdot 113, \ldots $$ The prime numbers appearing as factors of $F(n)$ form a sequence $$ 7, 13, 29, 43, 71, 113, 139, 239, \ldots $$ Now the question is:

What are these prime numbers?In fact, we can prove that every such prime number $p$, excluding 7, has the property that $p+1$ or $p-1$ is divisible by 7. Conversely, every such prime number appears as a factor $F(n)$ for some positive integer $n$.While learning class field theory on my own, I realized that the main theorem in easier cases can be formulated in terms of prime factors of $F(n)$ as above, and at that moment I was very happy. The polynomial $F$ cannot be taken arbitrarily. Actually, the equation $F(x) = 0$ has $2 \cos (2\pi/7)$ as a root, and that fact is essential. If $F(x) = x^2 - a$ with an integer $a$, the problem can be solved by the quadratic reciprocity law. In fact, my later work on the so-called complex multiplication is closely connected with this question of finding $F$ for which the sequence corresponding to [the sequence of integers above] can be determined.

My question concerns the arguments in the final excerpted paragraph. Namely, how exactly are easier cases of the Main Theorem of Class Field Theory related to this problem? Additionally, how does complex multiplication help in finding a polynomial $F$ given a sequence of primes as above?