separable polynomial 
How to show that if $K$ is a field of characteristic $p$ with $p$ prime and if $f(X)\in K[X]$ is an irreducible and inseparable polynomials, therefore there exist a $d\in\mathbb N, d>0$ such that $f(X)=g(X^{p^d})$ with $g$ irreducible and $g$ separable ?

I know that if $f(X)\in K[X]$ is inseparable if and only if $f'(X)=0$, therefore $f$ has the form of $a_n(X^{p})^i+...+a_1 (X^p)+a_0$ and thus, $f(X)=g_1(X^p)$. If $g_1(X)$ separable we are finish, but if $g$ is inseparable, therefore, I have $f(X)=g_2(X^{p^2})$. If $g_2(X)$ is separable, we are finish, but if not, I can continue... But my problem is how can I arrive to a separable polynomial $g$ such that $g(X)$ separable such that $f(X)=g(X^{p^d})$ ? 

That process you describe cannot last for ever: if $f(X)=g_k(X^{p^k})$ for some $k$ then $\deg f=p^k\deg g_k$, so this gives you a bound on how many times you can do this.
So do it as much as you can, and then you end up with a polynomial $g$ and a $d\geq1$ such that $f(X)=g(X^{p^d})$ and such that not all monomials appearing in $g$ are of degree divisible by $p$. Show now that $g$ is irreducible and separable.
