3. Determine all prime numbers $p$ for which $\frac{p^{2}-p-2}{2}$ is a cube of a natural number.
3. Let's write the condition of the problem in the form $p(p-1)=2 n^{3}+2=2(n+1)\left(n^{2}-n+1\right)$. Since $p=2$ is not a solution, $p$ divides $n+1$ or $n^{2}-n+1$. If $p \mid n+1$, then $p \leqslant n+1$, so $p(p-1) \leqslant n(n+1) \leqslant 2(n+1)\left(n^{2}-n+1\right)$. Therefore, $p \mid n^{2}-n+1$.

Let $n^{2}-n+1=k p, k \in \mathbb{N}$. Then $p-1=2 k(n+1)$, i.e., $p=2 k n+2 k+1$ and $n^{2}-n+1=2 k^{2} n+2 k^{2}+k$, which gives the quadratic equation in $n$:

$$
n^{2}-\left(2 k^{2}+1\right) n-\left(2 k^{2}+k-1\right)=0 \text {. }
$$

Its discriminant $D=\left(2 k^{2}+1\right)^{2}+4\left(2 k^{2}+k-1\right)$ must be a perfect square. Since $D$ is odd and $\left(2 k^{2}+1\right)^{2}<D<\left(2 k^{2}+1\right)^{2}+4\left(4 k^{2}+6\right)=\left(2 k^{2}+5\right)^{2}$, it follows that $D=\left(2 k^{2}+3\right)^{2}$, from which we easily get $k=3$. Now $n^{2}-19 n-20=0$, i.e., $n=20$, and from there $p=2 k(n+1)+1=127$.