javascript program to check if it is possible to reach ( a , b ) from ( x , y ) . Returns GCD of i and j
function gcd ( i , j ) { if ( i == j ) return i ; if ( i > j ) return gcd ( i - j , j ) ; return gcd ( i , j - i ) ; }