Find prime factors of Z such that Z is product of all even numbers till N that are product of two distinct prime numbers | Function to print the prime factorization of the product of all numbers <= N that are even and can be expressed as a product of two distinct prime numbers ; Sieve of Eratosthenese ; Store prime numbers in the range [ 3 , N / 2 ] ; Print the coefficient of 2 in the prime factorization ; Print the coefficients of other primes ; Driver code ; Input ; Function calling
def primeFactorization ( N ) : NEW_LINE INDENT sieve = [ 0 for i in range ( N // 2 + 1 ) ] NEW_LINE for i in range ( 2 , N // 2 + 1 , 1 ) : NEW_LINE INDENT if ( sieve [ i ] == 0 ) : NEW_LINE INDENT for j in range ( i * i , N // 2 + 1 , i ) : NEW_LINE INDENT sieve [ j ] = 1 NEW_LINE DEDENT DEDENT DEDENT prime = [ ] NEW_LINE for i in range ( 3 , N // 2 + 1 , 1 ) : NEW_LINE INDENT if ( sieve [ i ] == 0 ) : NEW_LINE INDENT prime . append ( i ) NEW_LINE DEDENT DEDENT x = len ( prime ) NEW_LINE print ( "2 - > " , x ) NEW_LINE for i in prime : NEW_LINE INDENT print ( i , " - > 1" ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 18 NEW_LINE primeFactorization ( N ) NEW_LINE DEDENT