How do I calculate the number of natural solutions of ax+by=c? I found out about getting the integer solutions of ax+by=c on other questions, and I also found out there exists a solution only when gcd(a,b)|c. But then I want to know how many natural solutions(x,y) there are(or how to figure out the number of them), where values a, b, and c are all natural numbers, but only c is given. edit : I forgot to mention an important detail, a+b< c
I tried messing around with it, but got stuck, like the following-
ax+by=c, therefore y=(c-ax)/b, but I can't quite figure it out from this point. My friend told me that I can't solve this because the only given number is c. Is he right? why or why not? This has been bothering me for weeks, so please help me :)
 A: You're right! When you solve the linear diophantine equation $ax+by=c$, this equation has infinite solutions if and only if $gcd(a,b)|c$.
To find all of these solutions, compute $gcd(a,b)$ using the Euclidean algorithm (you only need to find one solution $(x_0,y_0))$. Once you have $(x_0,y_0)$, the other solutions comes in the form:
$$x=x_0+\frac {bk}{gcd(a,b)}$$
$$y=y_0-\frac {ak}{gcd(a,b)}$$
For all integers $k$
Answering your question, it depends on the values of $a$ and $b$, given that for some natural numbers $a,b$ the $gcd(a,b)$ could or could not divide $c$. For instance: $ax+by=12$
If $a=3$ and $b=9$, the equation $3x+9y=12$ has solutions:
$$x=1+3k$$
$$y=1-k$$
For all integers $k$
But, if $a=5$ and $b=10$, then $gcd(a,b)=gcd(5,10)=5$ which doesn't divide $c$. Therefore, the equation has no solutions
Hope it helps!

To find all natural solutions restrict values of k for which $x>0$ and $y>0$:
$$x>0 \Rightarrow k>\frac {-x_ogcd(a,b)}{b}$$
$$y>0 \Rightarrow k<\frac {y_ogcd(a,b)}{a}$$
In conclusion: 
If $gcd(a,b)$ doesn't divide c, there are no natural solutions
If $gcd(a,b)$ divides c, exists a pair of natural solutions $(x_0,y_0)$ and the equation has a finite set of solutions of the form:
$$x=x_0+\frac {bk}{gcd(a,b)}$$
$$y=y_0-\frac {ak}{gcd(a,b)}$$
For all integers $k$ such that $k\in (\frac {-x_ogcd(a,b)}{b},\frac {y_ogcd(a,b)}{a})$
In other words, the number of natural solutions of the diophantine equation $ax+by=c$ where $c$ is given, is equal to the number of integers in the interval $(\frac {-x_ogcd(a,b)}{b},\frac {y_ogcd(a,b)}{a})$
