Can a polynomial $p(x)$ generate only primes and 2-almost primes $\forall x \ge 0 \in \Bbb N$ or there is also a restriction for this to happen? There is a simple demonstration to show that a polynomial of any degree can not generate only primes.
Basically, if $p(x)=a_nx^n+...+a_1x^1+a_0$ is prime for every $x \in \Bbb N$ ($\Bbb Z$ would be also fine for the demonstration), then for $x=0$, $p(0)=a_0$ must be prime and then for that reason $p(a_0)=a_na_0+..+a_1a_0+a_0 = a_0(a_n+..+1)=a_0k$ for some $k$ so $p(a_0)$ is composite, so $p(x)$ can not generate primes for any $x$.
But I wonder if it is possible to have a polynomial able to generate only primes and 2-almost primes. Initially I can not see clearly if is impossible or not applying a similar demonstration as above for only-prime polynomials.
For that reason I would like to ask the following questions:


*

*Is it possible the existence of a polynomial (it does not matter the degree) such as $p(x)$ is always prime or $2$-almost prime for any $x \ge 0 \in \Bbb N$ or there is also a restriction that makes impossible to have this kind of polynomial?


*Are there papers or references about such kind of polynomials? (or a demonstration why it is not possible).


*If such polynomial exists, would it be easier to sieve primes from it? Thank you!

 A: Every polynomial has values with arbitrarily many prime factors. In particular, we can show this from the following fact, which is very related to the proof you show:

If $P(x)$ is a polynomial, then $P(x)=P(x+k)\pmod k$.

A corollary of this is the following:

If $a$ is a factor of $P(x)$ and $b$ is coprime to $a$ and a factor of $P(x')$ for some $x$ and $x'$, then there is some $y$ such that both $a$ and $b$ divide $P(y)$.

The proof of this is simply using the Chinese Remainder Theorem - one has that if $y\equiv x\pmod a$, then $a$ divides $P(y)$ by the first lemma, and if $y\equiv x'\pmod b$, then $b$ divides $P(y)$. One may extend this statement to say that if you have a finite set of primes, each dividing some $P(x)$, there is a $P(y)$ divisible by every one of those primes, so if $P$ took on only $2$-almost primes, it would have to be that there were only ever two distinct prime factors of any $P(x)$.
However, this immediately gives a problem: A polynomial cannot have all of its prime factors reside in a finite set since, for a fixed set of primes $\{p_1,\ldots,p_n\}$, there are only $O(\log(k)^n)$ numbers less than $k$ factoring into only those primes, whereas a polynomial must take on $O(k^{1/d})$ values below a given threshold $k$. Thus, we must conclude that every polynomial $P$ has an infinite number of primes dividing some $P(x)$, and thus by the previous lemmas, has values $P(x)$ with arbitrarily many prime factors.
