Let $f(n)=n^5+n+1$
Observe that $n^5+n+1=(n^2+n+1)(n^3-n^2+1)$
Since $f(n)$ is a prime , we can assume $f(n)=p$ for some prime $p$ . Hence ,
$(n^2+n+1)(n^3-n^2+1)=p\cdot 1$
Since $n^2+n+1>1$ for all $n\geq 1$ , we will only have one case .
$n^2+n+1=p$ .... (i) , $n^3-n^2+1=1$ ....(ii)
From (ii) , we get $n=0$ or $1\implies n=1\implies p=3$ (by plugging $n=1$ in (i))
So , $\boxed{n=1}$ is the only solution.