Problem For any positive integer n,how many polynomials are there of degree n over $\mathbb{Z}_2$? How many distinct polynomials function from $\mathbb{Z}_2$to $\mathbb{Z}_2$?
Attempt
Let $f(x) \in \mathbb{Z}_2$ . $f(x)= x^n+x^{n-1}+....+a$ ,where $a\in {0,1}$. There are $2^n$ polynomials of degree n over $\mathbb{Z}_2$.
Doubt
How to calculate the number of distinct polynomials function from $\mathbb{Z}_2$ to $\mathbb{Z}_2$?
Yes or nearly depending on the interpretation of degree $n$.
If you mean degree exactly $n$ then the coefficient of $x^n$ must be $1$ and there are $n$ more coefficients to choose. So, as you say, there are $2^n$ of them.
If you mean degree at most $n$ then the coefficient of $x^n$ could be $0$ or $1$ and there will be $2^{n+1}$ polynomials.
Don't confuse the number of polynomials with the number of functions. There are only $4$ functions from $\mathbb{Z}_2$ to $\mathbb{Z}_2$. Two polynomials may evaluate to the same value for all $x \in \mathbb{Z}_2$ yet not be the same. For example $x^2 + x$ is zero for all $x \in \mathbb{Z}_2$ yet it is not the same as the zero polynomial.