Binary search to find out number of primes less than or equal to x
m , i = 0 , - 1 NEW_LINE while ( l <= r ) : NEW_LINE INDENT m = ( l + r ) // 2 NEW_LINE if ( v [ m ] <= x ) : NEW_LINE INDENT i = m NEW_LINE l = m + 1 NEW_LINE DEDENT else : NEW_LINE INDENT r = m - 1 NEW_LINE DEDENT DEDENT return i + 1 NEW_LINE