Highest Power in Factorial: Formula, Methods and Examples

Highest Power in Factorial means finding the greatest exponent of a number that divides a factorial exactly. For a prime p, use Legendre’s formula by adding the quotients obtained from n divided by p, p², p³ and so on. The same method extends to composite numbers through prime factorisation and minimum exponents.

On this page

What Is the Highest Power in a Factorial?

The highest power of a prime p in n! is the greatest exponent e for which p^e divides n!. It is denoted by v_p(n!) and is calculated using Legendre’s formula.

For n!, count the multiples of p, p², p³ and higher powers of p among the numbers from 1 to n. Thus, v_p(n!) = floor(n/p) + floor(n/p²) + floor(n/p³) + ... . Stop when p^k > n. For example, v_3(10!) = floor(10/3) + floor(10/9) = 3 + 1 = 4, so the highest power of 3 dividing 10! is 3^4.

Highest Power in Factorial Formula & Tricks

Important Formulas

Legendre’s Formula
v_p(n!) = ⌊n/p⌋ + ⌊n/p²⌋ + ⌊n/p³⌋ + ...

Here p is prime, n! = 1 × 2 × 3 × ... × n, and terms are included only while p^k ≤ n.

Highest Power of a Prime
Highest power of p in n! = p^{v_p(n!)}

First calculate v_p(n!), then raise p to that exponent.

Highest Power of a Composite Number
If a = p₁^{e₁}p₂^{e₂}...p_r^{e_r}, then the highest power of a in n! is a^k, where k = min(⌊v_{p₁}(n!)/e₁⌋, ..., ⌊v_{p_r}(n!)/e_r⌋).

Factor the base a and find how many complete copies of every prime factor are available in n!.

Quick Tricks

Write the successive powers first

For a prime p, list p, p², p³ and stop after the first power greater than n. This prevents missing a term in Legendre’s sum.

Example: For 50!, the powers of 2 needed are 2, 4, 8, 16 and 32. Therefore v₂(50!) = 25 + 12 + 6 + 3 + 1 = 47.
Use the minimum for composite bases

After finding the prime exponents in n!, divide each by the corresponding exponent in the composite base. The smallest quotient determines the answer.

Example: For 20!, v₂(20!) = 10 + 5 + 2 + 1 = 18 and v₃(20!) = 6 + 2 = 8. Since 12 = 2² × 3, k = min(18/2, 8) = 8, so 12^8 is the highest power of 12 in 20!.
Ignore powers greater than n

If p^j > n, then floor(n/p^j) = 0, so no further terms are needed.

Example: For 15!, the terms for p = 5 are floor(15/5) = 3; 25 > 15, so v₅(15!) = 3.

Highest Power in Factorial Concepts

Legendre’s Method for a Prime Factor

To find the exponent of a prime p in n!, add the integer parts of n/p, n/p², n/p³ and all later quotients that are non-zero.

The first quotient counts multiples of p, the second counts an additional factor of p in multiples of p², and so on. For 25!, v_5(25!) = floor(25/5) + floor(25/25) = 5 + 1 = 6. Hence 5^6 divides 25!, but 5^7 does not.

Example: v_2(10!) = floor(10/2) + floor(10/4) + floor(10/8) = 5 + 2 + 1 = 8. Therefore the highest power of 2 in 10! is 2^8.

Counting Prime Factors by Multiples

Each multiple of p contributes at least one factor p, each multiple of p² contributes one additional factor, and each multiple of p³ contributes another.

This layered counting explains why simply counting multiples of p is insufficient. For 16!, the multiples of 2 contribute 8, those of 4 add 4, those of 8 add 2, and 16 adds 1. Therefore v₂(16!) = 8 + 4 + 2 + 1 = 15.

Example: The number 8 contributes three factors of 2, while 12 contributes two. Legendre’s separate terms count these extra factors automatically.

Highest Power of a Composite Number

For a composite base, factor it into primes and use the smallest available complete-group count.

Suppose a = 2^2 × 3. If n! contains 2^u and 3^v, then it contains 12^k only when 2k ≤ u and k ≤ v. Hence k = min(floor(u/2), v). For 25!, v₂ = 12 + 6 + 3 + 1 = 22 and v₃ = 8 + 2 = 10, so the highest power of 12 is 12^10.

Example: For 10!, v₂(10!) = 8 and v₃(10!) = 4. Since 18 = 2 × 3², k = min(floor(8/1), floor(4/2)) = 2. Thus the highest power of 18 dividing 10! is 18².

Highest Power of a Product or Factorial Expression

When the required divisor is written as a product of prime powers, calculate the exponent of each prime separately before taking the minimum ratio.

For a divisor such as 72 = 2^3 × 3², determine v₂(n!) and v₃(n!), then calculate min(floor(v₂/3), floor(v₃/2)). The prime with the smaller ratio limits the power of 72 that can divide n!.

Example: For 15!, v₂ = 7 + 3 + 1 = 11 and v₃ = 5 + 1 = 6. For 72 = 2³ × 3², k = min(floor(11/3), floor(6/2)) = min(3, 3) = 3. Therefore 72³ is the highest power of 72 in 15!.

Highest Power in Factorial Video Lessons

Watch short topic-wise lessons for quick revision.

14 Lessons
Lesson 1 of 14 Quick Revision

Factorials: Trailing Zeros and Prime Powers

Learn how to find trailing zeros in factorials and determine the highest power of a prime that divides a factorial using standard number system methods.

Continue with more lessons and practice in PrepShots.Watch More in App - Start ₹1 Trial →
More Highest Power in Factorial Lessons Scroll to explore →

Practice Highest Power in Factorial Questions

Practise published questions related to this topic.

Highest Power in Factorial Quick Quiz

Attempt 5 questions and check your score instantly.

Quick Revision Notes

Highest Power in Factorial: Quick Revision

Use these rules to calculate prime and composite powers in factorials.

  • For prime p, v_p(n!) = floor(n/p) + floor(n/p²) + floor(n/p³) + ... .
  • Stop the sum when p^k > n.
  • The highest power of p dividing n! is p^{v_p(n!)}.
  • For a = p₁^{e₁}p₂^{e₂}..., the exponent of a is the minimum of floor(v_{p_i}(n!)/e_i).
  • Counting only multiples of p misses the extra factors contributed by multiples of p², p³ and higher powers.
  • If p > n, then p does not divide n!, so v_p(n!) = 0.

Highest Power in Factorial FAQs

What is the formula for the highest power of a prime p in n!?

Use v_p(n!) = floor(n/p) + floor(n/p²) + floor(n/p³) + ... . The highest power is then p^{v_p(n!)}.

What is the highest power of 5 in 100!?

v₅(100!) = floor(100/5) + floor(100/25) = 20 + 4 = 24. Therefore, the highest power of 5 is 5^24.

What is the highest power of 2 in 25!?

v₂(25!) = 12 + 6 + 3 + 1 = 22. Hence 2^22 is the highest power of 2 dividing 25!.

How do you find the highest power of 12 in 25!?

Since 12 = 2² × 3, calculate v₂(25!) = 22 and v₃(25!) = 10. Thus k = min(floor(22/2), 10) = 10, so the answer is 12^10.

Why are powers such as p² and p³ included in Legendre’s formula?

A multiple of p² contains at least two factors of p, and a multiple of p³ contains at least three. The additional terms count these extra factors after the first factor has been counted.

What happens when the prime p is greater than n?

No number from 1 to n is divisible by p, so v_p(n!) = 0. Therefore p does not divide n!.

Continue learning Highest Power in Factorial on PrepShots

Continue on PrepShots