8.30 Find all prime numbers \( p \) such that \( 2p^4 - p^2 + 16 \) is a perfect square.
(Leningrad Mathematical Olympiad, 1980)
[Solution 1] When $p=2$,
$$
2 p^{4}-p^{2}+16=44
$$

is not a perfect square.
Therefore, $p$ is an odd prime.
Let
$$
2 p^{4}-p^{2}+16=k^{2},
$$

where $k$ is an odd number.
$$
p^{2}\left(2 p^{2}-1\right)=(k-4)(k+4).
$$

Since $p$ is a prime, $p \mid k-4$ or $p \mid k+4$, but $p$ cannot divide both $k-4$ and $k+4$ at the same time, otherwise
$$
p \mid(k+4)-(k-4)=8,
$$

which contradicts $p$ being an odd prime.
Therefore, one and only one of $k+4$ and $k-4$ can be divisible by $p^{2}$.
If $p^{2} \mid k-4$, let $k-4=s p^{2}$, where $s$ is an odd number.
Then
$$
k+4=s p^{2}+8,
$$

thus
$$
p^{2}\left(2 p^{2}-1\right)=(k+4)(k-4)=s p^{2}\left(s p^{2}+8\right),
$$
which means
$$
\begin{array}{l}
s\left(s p^{2}+8\right)=2 p^{2}-1 . \\
\left(s^{2}-2\right) p^{2}=-8 s-1 .
\end{array}
$$

The right side of this equation is negative, so $s$ can only be $1$.
At this time,
$$
p^{2}=9, \quad p=3 .
$$

And when $p=3$,
$$
2 p^{4}-p^{2}+16=169
$$

is a perfect square.
If $p^{2} \mid k+4$, let $k+4=s p^{2}$, then $s$ is an odd number, thus
$$
\begin{array}{c}
k-4=s p^{2}-8 \\
\left(s^{2}-2\right) p^{2}=8 s-1 .
\end{array}
$$

When $s=1$, we have $-p^{2}=7$, which is impossible.
When $s \geqslant 3$, since
$$
\begin{aligned}
\left(s^{2}-2\right) p^{2} & >\left(s^{2}-4\right) p^{2} \\
& =(s+2)(s-2) p^{2} \\
& \geqslant 5 \cdot 9(s-2) \\
& =(8 s-1)+(37 s-89) \\
& \geqslant(8 s-1)+(111-89)
\end{aligned}
$$
$$
>8 s-1 \text {. }
$$

This also leads to a contradiction.
In summary, $2 p^{4}-p^{2}+16$ is a perfect square if and only if $p=3$.
[Solution 2] When $p=2$, $2 p^{4}-p^{2}+16=44$ is not a perfect square.
When $p \geqslant 3$, if $3 \nmid p$, then
$$
\begin{array}{c}
p^{2} \equiv 1 \quad(\bmod 3), \\
2 p^{4}-p^{2}+16 \equiv 2 \quad(\bmod 3),
\end{array}
$$

at this time $2 p^{4}-p^{2}+16$ is not a perfect square.
Thus, $3 \mid p$, and since $p$ is a prime, $p=3$.
And when $p=3$, $2 p^{4}-p^{2}+16=169$ is a perfect square.