Linear Diophantine Equations | Utility function to find the GCD of two numbers ; This function checks if integral solutions are possible ; First example ; Second example ; Third example
function gcd ( a , b ) { return ( a % b == 0 ) ? Math . abs ( b ) : gcd ( b , a % b ) ; } function isPossible ( a , b , c ) { return ( c % gcd ( a , b ) == 0 ) ; } let a = 3 , b = 6 , c = 9 ; if ( isPossible ( a , b , c ) ) document . write ( " " + " " ) ; else document . write ( " " + " " ) ; a = 3 ; b = 6 ; c = 8 ; if ( isPossible ( a , b , c ) ) document . write ( " " + " " ) ; else document . write ( " " + " " ) ; a = 2 ; b = 5 ; c = 1 ; if ( isPossible ( a , b , c ) ) document . write ( " " + " " ) ; else document . write ( " " + " " ) ;