Example 3 How many sets of positive integer solutions does the equation $3 x+5 y=501$ have?
(1967 American High School Mathematics Competition)
Solve: From $3 x+5 y=501$, we get
$$
x=\frac{501-5 y}{3}=167-2 y+\frac{y}{3}.
$$

Since $x, y$ are positive integers, $\frac{y}{3}$ must also be a positive integer. Let $\frac{y}{3}=t, t$ be a positive integer. Then
$$
y=3 t, x=167-6 t+t=167-5 t.
$$

Therefore,
$$
x=167-5 t, y=3 t \text{ ( } x, y, t \text{ are all positive integers). }
$$

Let $t=1$ to get $(x, y)=(162,3)$;
Let $t=2$ to get $(x, y)=(157,6)$,
......
Let $t=33$ to get $(x, y)=(2,99)$.
That is, when $t=1,2, \cdots, 33$, we get the positive integer solutions $(x, y)$, and there are no other positive integer solutions.
So the number of positive integer solutions is 33.
In fact, we can give a general formula to find the number of solutions for a general linear Diophantine equation.
Theorem If $(a, b)=1, a>0, b>0$, then
$$
\begin{array}{c}
a x+b y=N \quad(x \geqslant 0, y \geqslant 0) \\
\frac{N-(b l+a m)}{a b}+1.
\end{array}
$$

The number of solutions is
where $l$ is the smallest non-negative number satisfying $b l=N(\bmod a)$, and $m$ is the smallest non-negative number satisfying $a m=N$ $(\bmod b)$.

Proof: Let $x_{0}, y_{0}$ be a solution satisfying $x \geqslant 0, y \geqslant 0$ and $x_{0}$ is the smallest, then
$$
x=x_{0}+b t, y=y_{0}-a t.
$$

gives all integer solutions of $a x+b y=N$, where $t$ is an integer. Let $y_{0}$ be the largest one, then from $y=y_{0}-a t$ we get
$$
0 \leqslant t=\frac{y_{0}}{a}-\frac{y}{a} \leqslant\left[\frac{y_{0}}{a}\right].
$$

Also, from
$$
b l=N(\bmod a), a m=N(\bmod b),
$$

we have
$$
N=a r+b l, N=b T+a m,
$$

From the meaning of $l, m$ we know
$$
y_{0}=T=\frac{N-a m}{b}.
$$

Clearly, $l<a$, otherwise, from
$$
\begin{array}{c}
a r+b l=N, \\
a x+b y=N
\end{array}
$$

we know $r, l$ is a set of non-negative solutions, and $l$ is the smallest. And
$$
a x+b y=N
$$

all solutions can be given by
$$
x=r+s b, y=l-s a.
$$

Taking $s=1, y=1-a \geqslant 0$ is still a solution, which contradicts the minimality of $l$. On the other hand, from the conditions we have
$$
\begin{array}{c}
N \equiv b l \equiv b l+a m(\bmod a), \\
N \equiv a m \equiv a m+b l(\bmod b).
\end{array}
$$

Given the condition $(a, b)=1$, we get
$$
\begin{array}{c}
N \equiv a m+b l(\bmod a b), \\
a b \mid N-(a m+b l).
\end{array}
$$

This means $\frac{N-(a m+b l)}{a b}$ is an integer. Also, since
$$
\frac{y_{0}}{a}=\frac{T}{a}=\frac{N-a m}{a b}=\frac{N-(a m+b l)}{a b}+\frac{1}{a},
$$

and $l<a,\left[\frac{1}{a}\right]=0$, we have
$$
\begin{aligned}
{\left[\frac{y_{0}}{a}\right] } & =\left[\frac{N-(a m+b l)}{a b}+\frac{l}{a}\right] \\
& =\frac{N-(a m+b l)}{a b}+\left[\frac{l}{a}\right]=\frac{N-(a m+b l)}{a b},
\end{aligned}
$$

So $0 \leqslant t \leqslant\left[\frac{y_{0}}{a}\right]=\frac{N-(a m+b l)}{a b}$.
Hence $t$ can take $\frac{N-(a m+b l)}{a b}+1$ values, which is the number of solutions satisfying the conditions:
$$
\frac{N-(a m+b l)}{a b}+1.
$$