TITLE: Show that $p=2$ and $q=3$
QUESTION [5 upvotes]: Do there exist primes $p,q$ where $p\neq 2$, $q\neq 3$ and $p<q$ such that
$p^2\equiv 1\pmod{q}$ and $q\equiv 1\pmod{p}$?

I think the answer is no. Suppose there exists such a pair of prime $(p,q)$ such that $p^2\equiv 1\pmod{q}$ and $q\equiv 1\pmod{p}$.
We need to show that $p=2$, $q=3$.
$p^2\equiv 1\pmod{q}$ and $q\equiv 1\pmod{p}$. We have
$p^2\equiv 1\pmod{q}\implies q\mid p+1$ and $p\mid q-1$.
How to show that $p=2$, $q=3 $ from here?
Any hints will be appreciated.

REPLY [5 votes]: You have $q\mid (p^2-1)$ and $p\mid (q-1)$.
From the first condition, you have $q\mid (p-1)$ or $q\mid(p+1)$. The first cannot hold, because $p<q$. In the second case, you get $q=p+1$: indeed, $p+1\le q$ and $q\mid(p+1)$ imply $q=p+1$. If $p$ is odd, then $q$ would be even, which is impossible.