Filling the suffix array following the relation suffix ( i ) = __gcd ( suffix ( i + 1 ) , arr ( i ) )
suffix [ n - 1 ] = arr [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) suffix [ i ] = __gcd ( suffix [ i + 1 ] , arr [ i ] ) ; }