Let $p$ be a prime number. The number of monic irreducible polynomial $P\in{\mathbb F}\_p[X]$, in terms of the degree $d$, begins with
$${\rm irr}(1)=p,\qquad{\rm irr}(2)=\frac{p(p-1)}2,\qquad{\rm irr}(3)=\frac{p(p^2-1)}3,\qquad{\rm irr}(4)=\frac{5p^2(p^2-1)}{12}.$$
This seems to be the beginning of a nice sequence of polynomials in $p$. Does someone know the general formula?


**Motivation**. As F. Brunault pointed out to me, there is a polynomial $\Pi\_{n,p}$ that vanishes over ${\bf M}\_n({\mathbb F}\_p)$. Just take the *lcm* of all the polynomials of degree $n$ over $F\_p$. 
In closed form, it is the product of all the irreducible polynomials of degree $d\le n$, to the power $[\frac{n}{d}]$ (integral part). The degree of $\Pi\_{n,p}$ is 
$$\delta(n)=\sum\_{d\le n}d[\frac{n}{d}]{\rm irr}(d).$$
In terms of $n$, this degree is
$$\delta(1)=p,\quad\delta(2)=p(p+1),\quad\delta(3)=p(p^2+p+1),\quad\delta(4)=\frac13p(p+1)(5p^2-2p+3).$$


**Edit**. The values given above for $n=4$ are erroneous.



The number of irreducible polynomials over ${\mathbb F}_p$
The product of all monic irreducible polynomials of degree dividing $d$ in $\mathbb F\_q[x]$ is $$x^{q^d}-x,$$
so from Mobius inversion we get the number of irreducible polynomials of degree $d$ is
$$M \_d (q) = \frac{1}{d} \sum \_{k | d} \mu(k) q ^{d/k} $$
This is known as the [necklace polynomial](http://en.wikipedia.org/wiki/Necklace_polynomial).


