Traverse the given array and check if the common ratio between ith element and ( i - 1 ) th element is same or not
for ( var i = 2 ; i < n ; i ++ ) { if ( arr [ i ] / arr [ i - 1 ] != r ) return false ; } return true ; }