Let $p$ be a prime. I want to know:
For which primes $p$ is every nonzero element modulo $p$ a cubic residue, i.e., for all $a \not\equiv 0 \pmod{p}$, there exists $x$ such that $$ x^3 \equiv a \pmod{p}? $$
What I tried:
I recalled that the multiplicative group $(\mathbb{Z}/p\mathbb{Z})^\times$ is cyclic of order $p-1$. So the number of distinct cubic residues modulo $p$ should be $$ \frac{p-1}{\gcd(3, p-1)}.$$
Thus, if $3 \mid (p-1)$, not all elements are cubes, since there are fewer than $p-1$ distinct cubic residues. But if $\gcd(3, p-1) = 1$, i.e., $3 \nmid (p-1)$, then every nonzero residue is a cube.
I tested a few small primes:
- $p = 2$: trivially true.
- $p = 5$: $p-1 = 4$, $\gcd(3, 4) = 1$, and every nonzero residue mod 5 is a cube.
- $p = 7$: $p-1 = 6$, $\gcd(3, 6) = 3$ → not every residue is a cube.