Find all polynomials $\mathcal{f}$ such that $\mathcal{f}$ has coefficients $\in \mathbb{N}_0$ and $\mathcal{f}(1)=7, \mathcal{f}(2)=2017$. From (2018) Hong Kong TST 1 P2 Functions:

Find all polynomials $f$ such that $f$ has coefficients $\in \mathbb{N}_0$ and $f(1)=7, f(2)=2017$.

May I get some hints, instead of a complete solution? 
 A: Let the coefficients be $a_0, a_1, a_2...$ so that $f(x) = a_0 + a_1 x + a_2 x^2 + ...$, then consider what $f(1)=7$ means for those coefficients -- you can get bounds on them. Then, consider what $f(2)=2017$ means, further: since higher coefficients grow faster, but it has to add up to 2017, this puts much stronger bounds on the higher coefficients. You will find that all coefficients past a certain point must be zero. Now you have a finite set to consider.
A: So we are searching for such polynomial $p(x)= b_nx^n+...+b_2x^2+b_1x+b_0$ with non negative integer coefficients that:
$$b_0+b_1+..+b_n=7$$ and $$b_0+2b_1+...+2^nb_n =2017$$ 
So we want to write 2017 as a sum of some, not necessary different powers of 2.

All we have to do is find such numbers $a_1,...,a_7\in\mathbb{N}_0$, not necessary different that 
$$ 2^{a_1}+...+2^{a_7}=2017$$
We can assume $a_1\leq a_2\leq ...\leq a_7$. Because of the following lemma we can also assume that all those numbers are different.

Lemma: We can't write 2017 as a sum of at most 6 powers of the number 2.
Proof: Say we can. Then there exist $a,b,c,d,e$ (sixth power is $2^0$) such that 
$$1+2^a+2^b+2^c+2^d+2^e =2017$$ 
But with a greedy algorithm we see that the maximum value (in this case) of $ 2^a+2^b+2^c+2^d+2^e$ is $2^{10}+2^9+2^8+2^7+2^6<2016$. A contradiction.
Similar arguments work if we have less than 6 terms.

So, if $a_j$ are not distinct, one can combine them and express 2017 as a sum of less than $7$ terms with distinct exponents which is by lemma imposible.
It is obviously that $a_1=0$ so we have:
$$ 2^{a_2}(1+2^{a_3-a_2}+...+2^{a_7-a_2})=2016= 2^5\cdot 63$$
so $a_2=5$ and now we have:
$$ 2^{a_3-5}+...+2^{a_7-5}= 62$$ Now we have
$$ 2^{a_3-5}(1+2^{a_4-a_3}+...+2^{a_7-a_3})=2\cdot 31$$
so $a_3-5= 1$, so $a_3=6$. With similar procedure we see that $a_4=7$, $a_5=8$ $a_6=9$ and $a_7=10$. So we have only one polynomial and this is (hover to see the solution)

$$p(x)=x^{10}+x^9+x^8+x^7+x^6+x^5+1$$

A: Chinese remainer theorem implis any polynomial of rational coefficent satisfying the condition has the form
$$f(x)=2010x-2003+g(x)(x-1)(x-2)$$
So it suffices to find all $g$ such that $f(x)$ has nonegetive coeffients. By set $g(x)$ in terms, you can get a inequality of these conditions. 
A: Writing $f(x)$ as $\sum_{k=0}^n a_k x^k$ with $a_k \in \mathbb{N}_0$.
The condition $f(1) = 7$ is equivalent to $\sum_{k=0}^n a_k = 7$. 
For each $k$ with $a_k > 1$, we can split $a_k x^k$ as a sum of $a_k$ copies of $x^k$. As a result, there are seven $e_1, e_2, \ldots, e_7 \in \mathbb{N}_0$ such that $$f(x) = \sum\limits_{k=1}^7 x^{e_k}$$ 
The condition $f(2) = 2017$ implies $\displaystyle\;\sum\limits_{k=1}^7 2^{e_k} = 2017$
For any number $n \in \mathbb{N}_0$, let $h(n)$ be the number of set bits in the binary representation of $n$.
If we add $2^e$ to $n$, there are two possibilities.


*

*If the $e^{th}$ bit of $n$ is clear, $n + 2^e$ will have same bit pattern as $n$ except the $e^{th}$ bit is set.
This means $$h(n + 2^e) = h(n) + 1$$

*If the $e^{th}$ bit of $n$ is set, $n + 2^e$ will have the $e^{th}$ bit cleared and a carry is triggered.
When this happens, we can conceputally clear the $e^{th}$ bit and add $2^{e+1}$ to the resulting number. 
$$h(n + 2^e) = h((n - 2^e) + 2^{e+1})\quad\text{ and }\quad h(n-2^e) = h(n) - 1$$
Repeat this process until no carry is triggered. 
At the end, we find
$$h(n + 2^e) = h(n) + 1 - \verb/number of times carry get triggered/$$
In general, if $n$ is the sum of seven numbers of the form $2^e$, its $h(n)$ is at most $7$.
Now $2017 = {\rm 0x7e1}$. Its binary representation $111,1110,0001_2$ has exactly $7$ set bits. If one want to construct $2017$ as a sum of $7$ numbers of the form $2^e$, no carry can be triggered. This means the list of $e_k$ need to match the positions of set bits of $2017$ exactly.
As a result, polynomial $f(x)$ is unique and equals to (hover to see the solution)

$$f(x) = x^{10} + x^9 + x^8 + x^7 + x^6 + x^5 + 1$$

