#P10508. Counting the Exponent of 2 in the Product
Counting the Exponent of 2 in the Product
Counting the Exponent of 2 in the Product
Given a file numlist.txt that contains 1000 integers, compute the total number of times the prime factor \(2\) appears in the prime factorization of the product of these numbers.
In other words, if the file contains numbers \(a_1, a_2, \dots, a_{1000}\), and let \(P = a_1 \times a_2 \times \dots \times a_{1000}\), determine the exponent of \(2\) such that \(2^{\text{exponent}}\) divides \(P\) and \(2^{\text{exponent}+1}\) does not.
inputFormat
The input is provided as a file (or standard input) containing 1000 integers separated by spaces or newlines. Each integer is positive and you should consider every integer in the product.
outputFormat
Output a single integer representing the total number of times the prime factor \(2\) appears in the prime factorization of the product of the 1000 numbers.
sample
2 4 6 7 8
7