human
Smallest prime number missing in an array | This function finds all prime numbers upto 10 ^ 5.
use sieve to find prime.
If number is prime , then store it in prime list.
Function to find the smallest prime missing.
first of all find all prime.
now store all number as index of freq arr so that we can improve searching.
now check for each prime.
Driver Code.
find smallest prime which is not present"
How can the above be solved in Python?
 ... Can you provide a code to smallest prime number missing in an array and the other steps required?
assistant
#Here is code to smallest prime number missing in an array and the other steps required.
 def findPrime ( MAX ) :
	pm = [ True ] * ( MAX + 1 )
	pm [ 0 ] , pm [ 1 ] = False , False
	for i in range ( 2 , MAX + 1 ) :
		if pm [ i ] == True :
			for j in range ( 2 * i , MAX + 1 , i ) :
				pm [ j ] = False
	prime = [ ]
	for i in range ( 0 , MAX + 1 ) :
		if pm [ i ] == True :
			prime . append ( i )
	return prime
def findSmallest ( arr , n ) :
	MAX = max ( arr )
	prime = findPrime ( MAX )
	s = set ( )
	for i in range ( 0 , n ) :
		s . add ( arr [ i ] )
	ans = - 1
	for i in range ( 0 , len ( prime ) ) :
		if prime [ i ] not in s :
			ans = prime [ i ]
			break
	return ans
if __name__ == " _ _ main _ _ " :
	arr = [ 3 , 0 , 1 , 2 , 7 ]
	n = len ( arr )
	if ( findSmallest ( arr , n ) == - 1 ) :
		print ( " No ▁ prime ▁ number ▁ missing " )
	else :
		print ( findSmallest ( arr , n ) )