How many ordered pairs $(a, b)$, with $a$ and $b$ positive integers, satisfy

$$
a+b+\gcd(a, b)=33 ?
$$
Solution

Let $d=\gcd(a, b)$. We can rewrite the equation as:

$$
\frac{a}{d}+\frac{b}{d}+1=\frac{33}{d}
$$

Since the left side is a sum of integers, it follows that $d$ divides 33. Moreover,

$$
\begin{aligned}
\gcd\left(\frac{a}{d}, \frac{b}{d}\right) & =\gcd\left(\frac{a}{d}, \frac{33}{d}-1\right) \\
& =\gcd\left(\frac{b}{d}, \frac{33}{d}-1\right) \\
& =1
\end{aligned}
$$

For a fixed $d$, it is sufficient to find pairs of positive integers $(x, y)$ such that $\gcd\left(x, \frac{33}{d}-1\right)=1$ and $x+y=\frac{33}{d}-1$, because from this we will also obtain $\gcd\left(y, \frac{33}{d}-1\right)=1$ and that $(a, b)=(d x, d y)$ is also a solution. Let's examine the possibilities for $d$:

i) For $d=1$ and $x+y=32$, there are 16 solutions, as it is sufficient to choose $x$ to be odd.

ii) For $d=3$ and $x+y=10$, there are 4 solutions, as $x$ cannot be even or a multiple of 5.

iii) For $d=11$ and $x+y=2$, there is only 1 solution.

iv) We cannot have $d=33$, since $a$ and $b$ are positive.

Therefore, there are 21 pairs of solutions.