Zero function implies zero polynomial.
Solution 1:
The polynomial $a_1 + a_2x + \cdots + a_nx^{n-1}$ that you found has root $x=1$ and so, by the factor theorem, has a factor of $x-1$. Thus $$p(x) = x(x-1)(b_0 + b_1x + \cdots + b_{n-2}x^{n-2})$$ for some $b_0, \dots , b_{n-2}$. But because $$a_1 + \cdots + a_nx^{n-1} = (x-1)(b_0 + b_1x + \cdots + b_{n-2}x^{n-2}) = 0$$ for all $x\ne 0$, and $x-1=0$ only for $x=1$, this shows us that $b_0 + \cdots + b_{n-2}x^{n-2}$ is zero for all $x\ne 0, 1$. In particular, it is zero at $x=2$. Hence $$p(x) = x(x-1)(x-2)(c_0 + \cdots + c_{n-3}x^{n-3})$$ Continuing on in this way you'll find that $$p(x) = x(x-1)(x-2)\cdots (x-n)(d_0)$$ for some constant $d_0$. Now we know that $p(n+1) = 0$ and we also know that none of the linear factors $x, x-1, \dots, x-n$ is zero at $x=n+1$. Hence $d_0 = 0$.
But what does this have to do with the numbers $a_1, \dots, a_n$? Well we can recover the form $a_0 + a_1x + \cdots a_nx^n$ by multiplying through all of the factors of $p$. But it's clear that the highest power of $p$ will be $d_0x^n$. So $d_0 = a_n = 0$. Hence $p$ is in fact the polynomial $a_0 + a_1x + \cdots + a_{n-1}x^{n-1}$.
Applying the exact same argument to this new representation of $p$ shows that $a_{n-1}=0$, and then $a_{n-2}=0$, etc.
Of course I haven't really given the above as a polished proof, but I'm sure you can handle that.
Solution 2:
Assume that $p$ has degree $n$. If $p(x)=0$ for all $x$, then $$ p(1)=0,\ p(2)=0,\ \ldots\ , p(n+1)=0 $$ is a linear system of $n+1$ equations on the $n+1$ coefficients $a_0,\ldots,a_n$. This is a Vandermonde matrix, and so its determinant is non-zero. Thus the only possible solution to the system is $$ a_0=a_1=\cdots=a_n=0. $$ Of course, this argument shows that already if $p$ has $n+1$ roots, then it has to be zero.
Solution 3:
.Suppose you do not want to use the derivative, but are a beginning calculus student as mentioned above. Then you can use the following result:
Lemma : $\lim_{k \to \infty} \frac{p(k)}{k^n} = a_n$ (that is, it exists and equals $a_n$)
To prove this proposition, expand the polynomial : $\frac{p(k)}{k^n} = \sum_{i=0}^n a_ik^{i-n}$. Since $n \to \infty$, all the terms in the above expansion go to zero as $k \to \infty$, except when $i=n$, in which case the limit is just $a_n$, since $k^0 = 1$.
We now want to prove that if $p(x) = \sum_{i=0}^n a_ix^i$ is zero everywhere, then all the coefficients are zero.
Let us perform induction, on the maximum power that of $x$ that occurs in the expansion of $p$ as a polynomial (This is not the same as the degree). If $p$ is (expressed as) a degree $0$ polynomial $a_0$, then $a_0$ is a constant, hence must be zero.
Let $p(k) = \sum_{i=0}^n a_ix^i$. By the above argument, $a_n = \lim_{k \to \infty} \frac{p(k)}{x^k} = 0$, since $p$ is zero everywhere. Now $p(x)$ simplifies to $\sum_{i=0}^{n-1} a_ix^i$, and by induction, all the $a_i$ are zero.
Hence, the proposition follows.
Solution 4:
Note that according to the Fundamental Theorem of Algebra a polynomial of degree $n$ has exactly $n$ roots.
Now your function has infinitely many zeros, therefore it can not be a polynomial of degree $n$ for any $n$.
Thus all the coefficients are zero which makes your function to be identically zero.