I am trying to find the number of irreducible polynomials of degree $n$ over $\mathbb{F}_p$. Here is what I have done:
(1). Let $K=\mathbb{F}_{p^n}$. Let $M(n,p)$ the number of monic irreducible polynomials of degree $n$ over $\mathbb{F}_p$.
(2). Any root of a monic irreducible polynomial of degree $n$ is a primitive element of $K|\mathbb{F}_p$. Conversely, any primitive element of $K|\mathbb{F}_p$ is a root of a monic irreducible polynomial of degree $n$. Therefore, $$n\cdot M(n,p)=\text{ Number of primitive elements of }K|\mathbb{F}_p$$
(3). But we know that $K^{\times}$ is a cyclic group of order $p^n-1$. The primitive elements of $K|\mathbb{F}_p$ are precisely the generators of the cyclic group $K^{\times}$. The number of such generators are $\varphi(p^n-1)$.
(4). Combining (2) and (3) we conclude that $$M(n,p)=\frac{\varphi(p^n-1)}{n}$$
(5). Any irreducible polynomial of degree $n$ is a nonzero constant multiple of a monic irreducible polynomial of degree $n$. The number of such constants is $p-1$. Therefore the number of such polynomials is $$(p-1)\cdot M(n,p)=\frac{(p-1)\varphi(p^n-1)}{n}$$
So the final answer is $$\frac{(p-1)\varphi(p^n-1)}{n}$$
But my answer does not match with the usual way of solving this question which involves the Mobius inversion formula. What am I doing wrong?