How many modular inverse number pairs between $0$ and $n$?

50 Views Asked by At

How many positive a,b pair solutions are there for the formula below and is there an easy way to find them all?

$$a * b \equiv 1 \pmod{n}$$

Where $a,b,n \in \mathbb{Z}$ and $0 < a \leq b < n$