12. Given $p$ is a prime number, $r$ is the remainder when $p$ is divided by 210. If $r$ is a composite number and can be expressed as the sum of two perfect squares, find
(52nd Belarusian Mathematical Olympiad (Final C Category))
Let $p=210n+r$, then $07$.
Let $q$ be the smallest prime dividing $r$, i.e., $r=qm, q \leqslant m$, we get $210>r=qm \geqslant q^{2}$, so, $q \leqslant 13$.
On the other hand, $r$ cannot be divisible by 2, 3, 5, 7, otherwise $p$ would also be divisible by the same number, but $p$ is a prime, so $q>7$, hence $q=11$ or $q=13$. At this point, $r=a^{2}+b^{2}$, where $a$ and $b$ are positive integers.
If $q=11$, then $a^{2}+b^{2}$ is divisible by 11. Write down all the remainders of perfect squares when divided by 11: $0,1,4,9,5,3$, to get the sum of the remainders of two perfect squares to be divisible by 11, it must be that both $a$ and $b$ are divisible by 11, i.e., $a^{2}$ and $b^{2}$ are divisible by 121. Thus, $r=a^{2}+b^{2} \geqslant 121+121 \geqslant 242>210$. Contradiction.
Therefore, $q=13, m<\frac{121}{q}<17$, i.e., $m \leqslant 16$.
Since the smallest prime factor of $m$ is at least 13, hence $m=13$.
Thus, $r=mq=13^{2}=169$, and it satisfies $169=12^{2}+5^{2}$.