TITLE: Find all non-negative integer polynomials that satisfy : $P(1) = 8 $ ; $P(2) =2012 $
QUESTION [9 upvotes]: Find all non-negative integer polynomials that satisfy : $P(1) = 8 $ ;   $P(2) =2012 $
First, I set $Q(x) = P(x)+ax+b $ such that $1$ and $2$ are solutions of $ Q(x)$
$\Rightarrow 8+a+b = 0$  and  $2012 + 2a+b = 0$
$\Rightarrow a=-2004 ; b =1996 $
$\Rightarrow P(x) = (x-1)(x-2)R(x) +2004x-1996$
(Predicted result :$ P(x) = x^{10}+x^9+x^8+x^7+x^6+x^4+x^3+x^2 $)
But we have one more condition that the coefficients of $P(x)$ are non-negative integers, so I think I need to add another condition for $R(x)$ . But I don't have any more ideas. I hope to get help from everyone. Thanks very much !

REPLY [2 votes]: Note that $\deg P \le 10$ since $2^{11} > 2012$ and $\deg P \ge 9$ since the sum of coefficients is $8$ and $7\times 256+128 < 2012$ while $8\times 256 \ne 2012$
Let now $P=a_nx^n+...+a_0, a_0,..a_n \ge 0$ integers and assume there is a coefficient $a_k \ge 2$ and take minimal $k$ such; decomposing binary $a_k=2^{b_1}+..+2^{b_r}, b_1>b_2>..>b_r \ge 0, b_1 \ge 1$ and replacing $P$ by the polynomial $P_1$ with coefficients $c_m=a_m+1$ if $k+b_j=m$ for some $b_j>0$ above in the decomposition of $a_k$, $c_k=0$ if $b_r \ne 0$, $c_k=1, b_r=0$ and $c_m=a_m$ for the rest (allowing $c_m=1$ if somehow $k+b_j>n$ for some $j$ so taking the corresponding $a_m=0$), we get a polynomial $P_1$ with non-negative coefficients, $c_m \le 1, m \le k$ and $P_1(2)=2012, P_1(1) < 8$ since $b_1 \ge 1$ means that we replace at least $2^{b_1} \ge 2$ with $1$ in the coefficients of $P_1$ so we decrease strictly their sum.
If $P_1$ has a coefficient at least $2$ it must be at some $k_1 >k$ now and we repeat the above getting $P_2$ etc
Eventually (as all such polynomials have degree at most $10$ we must stop), we get a polynomial $Q$ with all coefficients $0,1$ st $Q(2)=2012, Q(1) \le 8$ where we have $Q(1)=8$ precisely when there is no reduction and $Q=P$
But now $2^9+...1 < 2012$ so $\deg Q =10$ and then $2^8+..1 < 2^9<2012-2^{10}$ so $\deg(Q-x^{10})=9$ and similarly we see that since
$2012-(1024+512)>256, 2012-(1024+512+256)>128$ and also $2012-(1024+512+256+128)>64$ we cannot skip the powers until $6$ either, so $Q(x)=x^{10}+x^9+x^8+x^7+x^6+R(x)$ with $R$ degree at most $5$ and coefficients $0,1$, while $R(1) \le 3, R(2)=28$
But then $\deg R \le 4$ and again since $28-16 >8$ we must have $\deg R=4, R=x^4+S, S(2)=12$ and $S$ has degree at most $3$, coefficients $0,1$ and at most two non zero such since $S(1) \le 2$. Plainly we must have $S=x^3+x^2$ and $Q=x^{10}+x^9+x^8+x^7+x^6+x^4+x^3+x^2$
However $Q(1)=8$ and this implies that that $Q=P$ as above so we are done!
Edit later - as per the comment below from @subrosar, since $Q$ has coefficients $0,1$, the fact that $Q(2)=2012$ implies that $Q$ must be the polynomial above directly as the binary decomposition of $2012$ is unique; then $Q(1)=8$ shows that $Q=P$ so $P$ is unique too!