In how many ways you can write $2015$ as a $20x+15y$? In how many ways you can write $2015$ as a $20x+15y$ where $x$ and $y$ are natural numbers?
So probably I can do it using Euclid's algorithm but right now I am not sure how to do it. Could anyone explain step-by-step how to do exercises like this? I will be so grateful!
 A: To write $2015=20x+15y$ is the same as writing $403=4x+3y$. The latter can be solved by Euclidean algorithm or you can take a simple guess as $x=100$ and $y=1$. Once you get one solution then you can get infinitely many solutions (not necessarily incongruent) by using something like
$$403=4(100+3k)+3(1-4k), \qquad \text{ where } \, k \in \mathbb{Z}.$$ 
A: This might be overkill, but it couldn't do any harm.
Let
$$\begin{align*}
f : \mathbb Z \times \mathbb Z &\rightarrow \mathbb Z \\
(x,y) &\mapsto 20x + 15y
\end{align*}$$
We are looking for solutions to $f(x,y) = 2015$.
Suppose you've found two solutions $(x,y)$ and $(X,Y)$. Then $f(X,Y) - f(x,y) = 0 = f(X-x,Y-y)$ and so $20(X-x) + 15(Y-y) = 0$. Let $n = X-x$ and $m = Y-y$. We can then see that we have:
$$(X,Y) = (x,y) + (n,m)$$
where $20n + 15m = 0$.
Note that any solution to this will add to $(x,y)$ to give another solution.
The point of this is to illustrate that any two solutions are 'separated' by a tuple $(n,m)$ which satisfies the equation $20n + 15m = 0$. This means that if we find just one solution to the original problem, we can generate all possible solutions by allowing ourselves to add any and all solutions for $(n,m)$.
All that is left to determine is the number of solutions to $20n + 15m = 0$. Any two such solutions $(n,m)$ and $(N,M)$ can be added to yield another solution. There is also the solution $(n,m) = (0,0)$. So what we have on our hands is a group of $2$-tuples. It is clear that in order to specify a pair $(n,m)$, we only need to specify one of the integers. This uniquely identifies the pair as there will be a unique solution given that one integer. So this group is finitely generated of rank $1$.
All we must do then is find a generating element of the group. $(3,-4)$ must be a generating element because $3$ and $-4$ are coprime and so this $2$-tuple could not have been generated by another element.
All possible $2$-tuple solutions to the null equation are thus $d(3,-4) : d \in \mathbb Z$ and so all possible solutions to the problem are:
$$(x,y) + d(3,-4) : d \in \mathbb Z$$
...where $(x,y)$ is some solution to the problem. $(100,1)$ is an obvious choice. So the complete set of solutions is:
$$(100,1) + d(3,-4) : d \in \mathbb Z$$
