1. Find all positive integers $n \geqslant 2$, such that for all integers $a$ and $b$ coprime with $n, a \equiv b(\bmod n)$ if and only if $a b \equiv 1(\bmod n)$.
The given condition is equivalent to each integer $a$ satisfying $(a, n)=1$,
$$
a^{2} \equiv 1(\bmod n) .
$$

In fact, if $a \equiv b(\bmod n)$ is equivalent to $a b \equiv 1(\bmod n)$, then by $a b \equiv 1(\bmod n)$, when $b=a$, we have $a^{2} \equiv 1(\bmod n)$. Conversely, if $a^{2} \equiv 1(\bmod n)$, for any integers $a, b$ satisfying $(a, n)=(b, n)=1$, from $a \equiv b(\bmod n)$ we get $a b \equiv a^{2} \equiv 1(\bmod n)$; from $a b \equiv 1(\bmod n)$ we get $a^{2} \equiv 1 \equiv b^{2}(\bmod n)$. Therefore, $a \equiv b(\bmod n)$. Thus, the given condition holds.

Let $n=p_{1}^{e_{1}} p_{2}^{e_{2}} \cdots p_{l}^{e_{l}}\left(e_{i} \geqslant 1\right)$ be the prime factorization of $n$. We prove that equation (1) is equivalent to
$$
a^{2} \equiv 1\left(\bmod p_{i}^{e_{i}}\right),
$$

where $i=1,2, \cdots, l$, and $\left(a, p_{i}\right)=1$.
If equation (1) holds, we only prove it for $i=1$.
Assume $\left(a, p_{1}\right)=1$. If some of the primes $p_{2}, p_{3}, \cdots, p_{l}$ divide $a$, without loss of generality, let $p_{2}, p_{3}, \cdots, p_{k}$ divide $a$, and $p_{k+1}, \cdots, p_{l}$ do not divide $a$, then $\left(a+p_{1}^{e_{1}} p_{k+1} p_{k+2} \cdots p_{l}, n\right)=1$.
By equation (1), we have
$$
\left(a+p_{1}^{e_{1}} p_{k+1} p_{k+2} \cdots p_{l}\right)^{2} \equiv 1(\bmod n).
$$

Therefore, $\left(a+p_{1}^{e_{1}} p_{k+1} p_{k+2} \cdots p_{l}\right)^{2} \equiv 1\left(\bmod p_{1}^{e_{1}}\right)$.
From this, we get
$$
a^{2} \equiv 1\left(\bmod p_{1}^{e_{1}}\right).
$$

Conversely, if equation (2) holds, assume $(a, n)=1$, then $a$ is coprime with each $p_{i}$. By equation (2), we get $a^{2} \equiv 1\left(\bmod p_{i}^{e_{i}}\right)$, for $i=1, 2, \cdots, l$. Therefore, $a^{2} \equiv 1\left(\bmod p_{1}^{e_{1}} p_{2}^{e_{2}} \cdots p_{l}^{e_{l}}\right)$, i.e., equation (1) holds.

Assume $n=p_{1}^{e_{1}} p_{2}^{e_{2}} \cdots p_{l}^{e_{l}}$ satisfies the condition. If $p_{i}=2$, by equation (2), since $\left(3,2^{e_{i}}\right)=1$, then $3^{2} \equiv 1\left(\bmod 2^{e_{i}}\right)$. Therefore, $e_{i} \leqslant 3$. Conversely, for all odd $a$, we have $a^{2} \equiv 1(\bmod 8)$. If $p_{j}>2$, by equation (2), since $(2, p_{j})=1$, then $2^{2} \equiv 1\left(\bmod p_{j}^{e_{j}}\right)$. Therefore, $p_{j}-3, e_{j}=1$. Conversely, for all integers $a$ coprime with 3, we have $a^{2} \equiv 1(\bmod 2^{3} \times 3)$. Therefore, $n=2,3,4,6,8,12,24$.