Home:ALL Converter>Writing a program that checks whether a linear equation has positive integer solutions

Writing a program that checks whether a linear equation has positive integer solutions

Ask Time:2014-12-13T19:13:20         Author:user2980055

Json Formatter

I'm trying to write an algorithm to determine whether a linear equation, specifically in the form of ax + by = c, has positive integer solutions for given a,b,c. It needs to be efficient since the numbers a, b, and c can be in range 0<=a,b,c<=10^16. How would I approach this problem?

Since it's a diophantine equation in question, I tried to check if the GCD of a and b divides c, but this way I can't differentiate between positive, negative, or zero solutions.

Algorithm to determine non-negative-values solution existance for linear diophantine equation

I found a solution here, but I didn't quite understand it. Maybe someone can simplify it for me? Since this one is pretty general and I'm only interested in equations with 2 variables.

Author:user2980055,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/27458157/writing-a-program-that-checks-whether-a-linear-equation-has-positive-integer-sol
yy