0
$\begingroup$

I am trying to solve a problem that boils down to finding the number of solutions of a linear Diophantine equation with restrictions. To be precise for equations :

$ax + by + cz = k$ and $x + y + z = n$

Refer the solution under "Diophantine Systems with Restrictions" on this page. How do I code this mathematical solution? My constraints include $k$ ranging from $-10^{9}$ to $10^9$ and $n$ from $1$ to $10^5$. Also, what would be the run time. I can code this but in a very haphazard and inefficient manner. Is there a neat or maybe a standard solution to this?

$\endgroup$
0
$\begingroup$

I suppose you would start by substituting z = n - x - y in the first equation, giving (a - c)x + (b - c)y = (k - cn).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy