<s>[INST] Find all primes $p$ for which the equation $x^6 \equiv -1$ mod $p$ has a solution. I'm not sure if i could apply Wilson's theorem here.
 [/INST] Since $(x^3)^2 + 1^2 = 0$ mod $p$, $p$ is $1$ mod $4$ (Fermat's two squares)
$(x^2)^3 + 1^3 = (x^2 + 1)(x^4 + x^2 + 1) = 0 $ mod $p$
$\implies p | x^2 + 1$ as $p$ has to be of the form $a^2 + b^2$ (Fermat and skipping steps)
So if we take any $p$ such $p$ is a factor of $x^2 + 1$ then the equation $x^6 + 1 = 0$ mod $p$ holds.  
</s>