$m, n$ are integers, find all integer solutions of the diphantine equation:
$$nx + (n + 2)y = m$$
where $n$ is odd.
I´ve tried with Euclides but i get this:
$$2m = (n + 2)m – nm$$
I need a hint or something.
diophantine equationselementary-number-theory
$m, n$ are integers, find all integer solutions of the diphantine equation:
$$nx + (n + 2)y = m$$
where $n$ is odd.
I´ve tried with Euclides but i get this:
$$2m = (n + 2)m – nm$$
I need a hint or something.
Best Answer
The diophantine equation $ax+by=c$ has solutions if and only if $gcd(a,b)|c$.
So for this equation $nx + (n+2)y = m$ to have solution $gcd(n, n+2)|m$ and $gcd(n, n + 2)$ is 1
From the Extended Euclidean Algorithm, given any integers $a$ and $b$ you can find integers $s$ and $t$ such that $$as+bt=gcd(a,b)$$ ($s$ and $t$ may not be unique) where $a = n, b = (n+2)$ and $gcd(a, b)=1$. Now multiply $m$ to both sides. you'll get $n(sm) + (n+2)(tm) = m$, this gives a solution $x=sm$, $y =tm$.
Here is a very similar problem which explains how to get other solutions from this