题意:给定 \(n\),求方程 \(\frac 1 a - \frac 1 b=\frac 1 n\) 的所有解,且解必须满足 \(\gcd(a,b,n)=1\). 以下内容搬运自官方题解: 转化一下: \[bn=a(b+n) \] \[a=\frac {bn} {b+n} \] 根据 \(\gcd(a,b,n)=1\),有: \[\gcd(\frac {bn} {b+n},b,n)=\gcd(\frac {bn} {b+n},\gcd(b,n))=1 \] 接下来设 \(b=x \times…