human
Elements of Array which can be expressed as power of prime numbers | Function to mark all the exponent of prime numbers.
If number is prime then marking all of its exponent true.
Function to display all required elements.
Function to print the required numbers.
To find the largest number.
Function call to mark all the Exponential prime nos ..
Function call.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to elements of Array which can be expressed as power of prime numbers and the other steps required.
 def ModifiedSieveOfEratosthenes ( N , Expo_Prime ) :
	primes = [ True ] * N ;
	for i in range ( 2 , N ) :
		if ( primes [ i ] ) :
			no = i ;
			while ( no <= N ) :
				Expo_Prime [ no ] = True ;
				no *= i ;
			for j in range ( i * i , N , i ) :
				primes [ j ] = False ;
def Display ( arr , Expo_Prime , n ) :
	for i in range ( n ) :
		if ( Expo_Prime [ arr [ i ] ] ) :
			print ( arr [ i ] , end = " ▁ " ) ;
def FindExpoPrime ( arr , n ) :
	max = 0 ;
	for i in range ( n ) :
		if ( max < arr [ i ] ) :
			max = arr [ i ] ;
	Expo_Prime = [ False ] * ( max + 1 ) ;
	ModifiedSieveOfEratosthenes ( max + 1 , Expo_Prime ) ;
	Display ( arr , Expo_Prime , n ) ;
if __name__ == " _ _ main _ _ " :
	arr = [ 4 , 6 , 9 , 16 , 1 , 3 , 12 , 36 , 625 , 1000 ] ;
	n = len ( arr ) ;
	FindExpoPrime ( arr , n ) ;