TAOCP 1.2.4 Exercise 13

By convention, $\gcd(0,n)=|n|$.

Section 1.2.4: Integer Functions and Elementary Number Theory

Exercise 13. [M00] By convention, we say that the greatest common divisor of 0 and $n$ is $|n|$. What integers are relatively prime to 0?

Verified: yes
Solve time: 2m22s


By convention, $\gcd(0,n)=|n|$. Two integers are relatively prime if their greatest common divisor is $1$. Therefore an integer $x$ is relatively prime to $0$ if and only if

$$ \gcd(x,0)=|x|=1. $$

The only integers satisfying $|x|=1$ are $x=1$ and $x=-1$.

Hence the integers relatively prime to $0$ are precisely

$$ \boxed{\pm1}. $$