Find the gcd of the array elements
var result = 0 ; for ( i = 0 ; i < n ; i ++ ) { result = __gcd ( result , arr [ i ] ) ; } return result ; } function __gcd ( a , b ) { return b == 0 ? a : __gcd ( b , a % b ) ; }