I have two coprime univariate integer polynomials. Although they have no common factor as polynomials, they may have common factors at some (integer) values. How can I find such a value?
For example, suppose the polynomials are $x^3-x^2+3x-1$ and $x^3+2$. They are coprime in $\mathbb{Z}[x]$, but $\gcd(27^3-27^2+3\cdot27-1, 27^3+2)=\gcd(19034,19685)=31.$
We know that : "two polynomials in $\mathbb{F}[x]$ have a common root (possibly in some field extension of $\mathbb{F}$)" $\Leftrightarrow$ "the resultant of these two polynomials is zero", which implies that for some prime $p$:
"there is a positive integer $n$ such that $\gcd\big(f(n), g(n)\big)=p$" $\Rightarrow$ "the polynomials $f,g$ have a common root $\mod p$" $\Rightarrow$ "their resultant is zero $\mod p$" $\Leftrightarrow$ "their resultant is a multiple of $p$"
(Here, we view the polynomials $f(x)=x^3-x^2+3x-1$, $g(x)=x^3+2$ as polynomials of $\mathbb{Z}_p[x]$)
Thus, it suffices to investigate the prime divisors of the resultant: if $r$ is a divisor of the resultant $Res\big(f,g\big)=k$, then any solution of the simultaneous polynomial equations: $$f(x) \equiv 0 \mod r \\ g(x) \equiv 0 \mod r $$ provides a value of $x=n$ for which: $\gcd\big(f(n),g(n)\big)\geq r>1$.
So, using Mathematica:
In[1]:= Resultant[x^3 - x^2 + 3 x - 1, x^3 + 2, x]
Out[1]= 31
and thus: $$ \bigg\{ \begin{array}{c} n^3 - n^2 + 3 n - 1\equiv 0\mod 31 \\ % \\ n^3+2\equiv 0\mod 31 \end{array}\bigg\} \Rightarrow n\equiv27\mod 31 $$ Therefore, as user lhf already mentioned in his answer: $\gcd(f(n),g(n))=31$ for all values $n=27+31k$, where $k\geq 0$. For all other values of $n$, $\gcd(f(n),g(n))=1$.