$P(-2)=P(-5)=n$ Prove that if $n$ is a positive integer, there exists only one polynomial $\displaystyle P(x)=\sum_{i=0}^n a_ix^i$ degree $n$ that satisfies:
$(i):\,a_i\in\{0,1,\ldots,9\}$
$(ii):P(-2)=P(-5)=n$
 A: Suppose there are two polynomials $P(x)$ and $Q(x)$ that satisfy the constraints. Then, we can take $R(x)=P(x)-Q(x)$. We know that $R(-2)=R(-5)=n-n=0$. Also, the coefficients of $R$ are in $\{-9,-8,\dots,8,9\}$. It follows that
$$
R(x)=(x+2)(x+5)S(x)=(10+7x+x^2)S(x)
$$
where $S(x)$ is the quotient of $R(x)$ when divided by $(x+2)(x+5)$. Now say that
$$
S(x)=\sum_{i=0}^{n-2}b_ix^i
$$
with $b_i$ integers, because $(x+2)(x+5)$ is monic.
(We sum up to $n-2$, because we multiply with a polynomial of degree $2$ to get $R$.) Let $j$ be the smallest value of $i$ for which $b_i$ is not $0$, assuming such an $i$ exists. If it does not exist, we know that $S(x)=0$ for all $x$, so $R(x)$ is zero, which yields a contradiction, because $R(-2)=n\neq 0$.
Now look at $a_j$. We know it has to be equal to $10 b_j$, because the only possible way to get a term with $x^j$ in $R$ is to take the $x^j$ from $S$ and the $10$ from $10+7x+x^2$ (because $x^{j-1}$ and $x^{j-2}$ don't occur in $S$). We find that $a_j=10 b_j$. Because $-9\leq a_j\leq 9$ and $b_j$ is an integer, $a_j=b_j=0$, but we assumed $b_j\neq 0$. Thus, we arrive at a contradiction, and thus, there can be only one polynomial with the required properties.
