Extract the index which has the next greater prime
x = - 1 NEW_LINE for j in range ( len ( primes ) ) : NEW_LINE INDENT if ( arr [ i ] == primes [ j ] ) : NEW_LINE INDENT x = j NEW_LINE break NEW_LINE DEDENT elif ( arr [ i ] < primes [ j ] ) : NEW_LINE INDENT x = j NEW_LINE break NEW_LINE DEDENT DEDENT