Solving a first-order diophantine equation with many terms

1.7k Views Asked by At

Given a linear Diophantine equation with many terms, for example

$aw + bx + cy + dz = e$

How do you work out $w, x, y, z$, without brute force? $a, b, c, d, e$ are given; they are also natural numbers. $a, b, c, d$ are co-prime. $w, x, y, z$ can be any integer.

I've seen this algorithm, but it looks like it only works for 2 terms. I want an algorithm that can work for any number of terms.

There are an infinite number of solutions, any of them are fine, but ones where $w$ and friends are closer to zero are better.

Context: I'm trying to extend the answer given here to multiple terms.

1

There are 1 best solutions below

0
On

A method is given in Leon Bernstein's paper, The linear diophantine equation in $n$ variables and its application to generalized Fibonacci numbers, available at http://www.fq.math.ca/Scanned/6-3/bernstein.pdf I believe this is from the June 1968 issue of the Fibonacci Quarterly, pages 3 to 63.

See also (Diophantine?) Equations With Multiple Variables? (perhaps the current question should be closed as a duplicate of this older one?)