# Prime factorization of a factorial?

how would you go about finding the prime factors of a factorial.

for example what is the prime factorization of 40!

thats the prime factorization of 40... I'm looking for the prime factorization of 40! (40 factorial) that is, 40 x 39 x 38 x 37 ... x 3 x 2 x 1

### 5 Answers

- Sean HLv 51 decade agoBest Answer
Let me try to do 40! first, and then say something about the more general case. Obviously the prime factorization of 40! only contains primes less than 40- the question is what the power of each should be. The primes less than 40 are:

2,3,5,7,11,13,17,19,23,29,31,37.

How many factors of say 2 are there in 40! ? First of all, the number of numbers less than or equal to 40 that have a factor of 2 is:

floor(40/2) = 20.

(Here floor(x) means round to the largest integer smaller than x). Of course some of them have more than one factor of 2. How many of them have at least two factors of 2? Every other one does so it's:

floor(20/2) = 10.

How many of them have 3 factors of 2?

floor(10/2) = 5.

4 factors of 2?

floor(5/2) = 2.

5 factors of 2?

floor(2/2) = 1.

So the total number of factors of 2 is:

20+10+5+2+1 = 38.

Similarly, you could find the number of factors of 3 as

floor(40/3) + floor(13/3) + floor(4/3) = 13 + 4 + 1 = 18.

Doing the rest:

floor(40/5) + floor(8/5) = 8 + 1 = 9,

floor(40/7) = 5,

floor(40/11) = 3,

floor(40/13) = 3,

floor(40/17) = 2,

floor(40/19) = 2,

and the rest are 1. So the prime factorization is

40! = 2^{38} 3^{18} 5^{9} 7^{5} 11^{3} 13^3 17^2 19^2 23 29 31 37.

You can write the calculation for the exponent of the prime p in the more compact form

sum_{i=1}^{floor(log_p(40)} floor(40/p^i).

That's a sum from 1 to log base p of 40. A similar formula would allow you to write a formula for the prime factorization of n! for general n. I don't know if there's a simpler way ... .

- 1 decade ago
you find the prime factorization of a number by looking for the prime numbers that will give you that number.

Ex. Find the prime factorization of 40

40

/ \

4 * 10

/\ /\

2 2 2 5

As you can see 2 and 5 are prime numbers!

That's the matter the number you use it will always give you the same answer

40

/ \

8 5

/\

4 2

/\

2 2

Source(s): Meh - How do you think about the answers? You can sign in to vote the answer.