Text: Want an efficient Python code.
def factoring_factorial(n):
The fundamental theorem of arithmetic tells us that every positive integer can be broken down into the product of its prime factors in exactly one way. Given a positive integer n > 1, create and return a list that contains all prime factors of n, the product of all positive integers up to n, along with their exponents in the prime factorization. These prime factors should be listed in ascending order, with each prime factor given as a tuple (p, e) where p is the prime factor and e is its exponent.
Since n will get into the thousands in the automated tester, you should accumulate the prime factors of n separately for each individual term of the factorial as you go, rather than first computing the entire n! and then afterwards dividing it down into its prime factors.
n
Expected result
5
[2, 3, 3, 5]
10
[2, 2, 2, 3, 5]
20
[2, 2, 2, 2, 2, 3, 5]
100
[2, 2, 2, 5, 5]