$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.
$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.
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
Hint if $n=2k+1$ then $n+2=2k+3$.
Then $$1=2k+1-2k=n-k(n+2-n)=n(1+k)-(n+2)k$$
Multiplying by $m$ you get the solution $$x_0=m(1+k)\\ y_0=-km$$
Now solve $$n(x-x_0)+(n+2)(y-y_0)=0$$
Hint $\,\ 1 = n(\overbrace{x\!+\!y}^{\Large z}) + 2y \iff (z,y)\, =\, \overbrace{(1,(1\!-\!n)/2)}^{\rm particular} + \overbrace{k(-2,n)}^{\rm homogeneous}$