Example 5 Find all prime numbers $p$ that satisfy the following condition: for any prime number $q$ less than $p$, the remainder $r$ when $p$ is divided by $q$ has no square factor greater than 1. ${ }^{[3]}$
(1999, IMO China National Training Team Selection Exam)
【Analysis】Select simple prime numbers for mathematical experiments.
When $p=2$, there is obviously no prime number $q$ less than 2, so the conclusion holds.
When $p=3$, $q=2, r=1$, the conclusion holds.
When $p=5$, if $q=2$, then $r=1$;
if $q=3$, then $r=2$.
The conclusion holds.
When $p=7$, if $q=2$, then $r=1$;
if $q=3$, then $r=1$;
if $q=5$, then $r=2$.
The conclusion holds.
When $p=11$, if $q=7$, then $r=4$, the conclusion does not hold.
When $p=13$, if $q=2$, then $r=1$;
if $q=3$, then $r=1$;
if $q=5$, then $r=3$;
if $q=7$, then $r=6$;
if $q=11$, then $r=2$.
The conclusion holds.
When $p=17$, if $q=13$, then $r=4$, the conclusion does not hold.

When $p=19$, if $q=11$, then $r=8$, the conclusion does not hold.

When $p=23$, if $q=19$, then $r=4$, the conclusion does not hold.

Conjecture: When $p>23$, the conclusion does not hold, i.e., there exists a prime number $q$ less than $p$ such that the remainder $r$ when $p$ is divided by $q$ has a perfect square factor greater than 1.
The possible values of $r$ are $4,8,9,12,16, \cdots$.
Assume there exists $p>23$ that satisfies the condition, then $p-4$ has no prime factor greater than 3, i.e.,
$$
p-4=3^{a}, p=3^{a}+4 \text {. }
$$

Similarly, $p-8$ has no prime factor greater than 7, i.e.,
$p-8=3^{a}-4=5^{b} \times 7^{c}(b, c$ may be 0$)$.
Modulo 3 congruence, $2^{b} \equiv-1(\bmod 3)$, then $b$ is odd, set $b=2 B+1$.

Modulo 5 congruence, $3^{a} \equiv 4(\bmod 5)$, then $a=4 A+2$ is even.
$p-9$ has no prime factor greater than 7, i.e.,
$p-9=2^{d} \times 5^{c} \times 7^{f}=p-8-1=5^{b} \times 7^{c}-1$,
$b \neq 0$,
then $e=0$.
Obviously, at least one of $c, f$ is 0.
If $f \geqslant 1$, then $c=0$. At this time, $5^{b}-1=2^{d} \times 7^{f}$, where $b=2 B+1$, modulo 7 congruence cannot hold $\left(5^{2 B+1}\right.$ $\equiv 5,6,3(\bmod 7))$, therefore, $f=0$.

At this time, $p-8=5^{b} \times 7^{c}=2^{d}+1$, modulo 5 congruence, $2^{d}+1 \equiv 0(\bmod 5)$, we get $d=4 D+2$.
Modulo 7 congruence,
$$
\begin{array}{l}
2^{4 D+2}=4 \times 2^{D} \times 8^{D} \equiv 4 \times 2^{D} \\
\equiv 4,1,2(\bmod 7),
\end{array}
$$

i.e., $c=0$.
In summary, $p=3^{a}+4=5^{b}+8=2^{d}+9$, where $a=4 A+2, b=2 B+1, d=4 D+2$.
Thus, $5^{b}=3^{4 A+2}-4=\left(3^{2 A+1}-2\right)\left(3^{2 A+1}+2\right)$.
Therefore, $3^{2 A+1}-2=5^{\alpha}, 3^{2 A+1}+2=5^{\beta}$, where $\beta>\alpha$.
Subtracting the two equations gives $5^{\beta}-5^{\alpha}=4$, i.e., $\alpha=0$.
Then $3^{21+1}=2+5^{\alpha}=3$, i.e., $A=0$.
Thus, $p=3^{a}+4=3^{41+2}+4=13$, which contradicts $p>23$.
In summary, only the prime numbers $2,3,5,7,13$ satisfy the condition.