Number of solutions of: $3x+y=5702$ 
Find the number of ordered pairs $(x,y)$ satisfying  $3x+y=5702$ in
  natural numbers restricted by: $x+y\le2003$

I don't know any method for counting number of solutions of such equations...
 A: I'll find all the integer solutions of $3x+y=5702$.
First, mod $3$ gives $y\equiv 2\pmod{3}$. Let $y=3k+2$, $k\in\mathbb Z$.
$$3x+3k+2=5702\iff 3(x+k)=5700$$ $$\iff x+k=1900\iff x=1900-k$$
All the integer solutions are $(x,y)=(1900-k,3k+2)$, $k\in\mathbb Z$.
$$x+y=(1900-k)+(3k+2)$$
$$=2k+1902\le 2003$$
$$\iff k\le 50.5\iff k\le 50$$
Natural numbers have different definitions among different authors (they do or don't include $0$; see Wikipedia or MathWorld).
Assuming $0\in\mathbb N$, you want to find all $k\in\mathbb Z$ such that $1900-k\ge 0$, $3k+2\ge 0$, $k\le 50$.
You'll get $k\in\{0,1,2,\ldots,50\}$, which will generate all the $(x,y)$ that the problem is asking about.
I.e., all the needed pairs are $$(x,y)\in\{(1900,2),(1899,5),(1898,8),\ldots,(1850,152)\}$$ There are $51$ such pair.
A: Hint:
Well, there's one solution for $x=1$, and one for $x=2$, and another for $x=3$ and so on.
Now, that would give you infinitely many solutions, but you have two restrictions:


*

*$x$ and $y$ are natural numbers, so they are greater than $0$.

*The sum of $x$ and $y$ must be smaller than $2003$, so that disqualifies $x=1, y=5699$, for example.


Can you continue from here to determine all solutions?
A: Here is a first overview:

(Large version)
It shows the constaints $x \ge 1$, $y \ge 1$, $x+y\le 2003 \, (*)$ (the blue coloured half-space) and the line $3x + y = 5702$ (black diagonal line).
We see that the solutions lie on the last points of the line. below $y = 200$ (yellow line) and not lower than $y = 1$.
The line enters the region of constraint $(*)$ at the intersection of
$$
x + y = 2003 \\
3x + y = 5702 
$$
which means
$$
x + y = 2003 \\
-2y = -307
$$
or
$$
x = 1849.5 \\
y = 153.5
$$
To lie on the grid $\mathbb{Z}^2$ we need $x = (5702 - y) / 3$ to be a whole number, or
$$
5702 - y = 3 k \quad (k \in \mathbb{Z}) \iff \\
0 
= (5702 - y) \bmod 3 
= ((5702 \bmod 3) - (y \bmod 3)) \bmod 3
= (2 - y \bmod 3) \bmod 3 \iff \\
y \bmod 3 = 2 \iff \\
y = 2 + 3 k \quad (k \in \mathbb{Z})
$$
So the first solution is $((5702 - 152)/3, 152) = (1850, 152)$, as $y=153$ is not on the grid.
And the last solution is $((5702-2)/3,2) = (1900, 2)$.
All solutions are
$$
\{ (5702 -(2 + 3k))/3, 2 + 3k) \mid k \in \{ 0, \dots, 50 \} \} = \\
\{ (1900-k, 2 + 3k) \mid k \in \{ 0, \dots, 50 \} \}
$$
and we count $51$ of them.
