What is Legendre's theorem?

Legendre's theorem states that the p-adic valuationThe p-adic valuation of an integer x is the exponent of the highest power of the prime number p that divides x. of xx denoted by vp(x)v_p(x) is defined as a positive integer, nn, such that pnp^n divides xx, where pp is a prime number and xx is a positive integer. Legendre’s formula can be shown as follows:

Where x\lfloor {x}\rfloor is a floor functionFloor function takes a real number x as input, and return the nearest lowest integer. For example input = 2.61 output = 2 and ii is the range,1i1 \le i \le \infty. However, despite ii being infinite, only the first few terms; x/pi1x/p^i \ge 1, are counted because the other terms are equal to 00 due to the floor function and do not affect the summation process.

An alternate form of Legendre’s formula that involves the base-p expansion of xx is as follows:

Where sp(x)s_p(x) represents the sum of the digits in the base expansion of xx.

Working of Legendre's theorem

The working of Legendre's theorem can be understood in more detail using the examples of the original and alternate forms given below.

Original form

The number nn denoted by vp(x)v_p(x), represents the exponent of the largest power of the prime number pp, which can divide the factorial x!x!. The number nn can be calculated by plugging in the values of xx and pp into the equation directly, but before we do that, we have to explore a simple solution. The number nn is the exponent of pp in the prime factorizationIt is the process of breaking down the original number into the prime numbers, that can multiplied together to gain the original number. of xx.

We take an example where x=7x = 7; First, we do prime factorization as shown below:

We can see that 66 and 44 are not prime numbers, so we divide them even further as shown below:

Simplify and re-write:

Using this, we can deduce the value of v2(7!)=4v_2(7!) = 4, v3(7!)=2v_3(7!) = 2, and v5(7!)=1v_5(7!) = 1 by checking the exponent of the prime number pp. We can verify the results by plugging the values into the original equation as shown below:

The equations above show a solved example using the prime factorization, and Legendre's original formula produces the same result.

Alternate form

In this example we let x=11x = 11 and p=2p = 2. To use the alternate form, we need to convert xx from base 1010 to base pp, where pp is the prime number. Conversion of the base of xx is shown below:

Now, calculate as s2(11)s_2(11) shown below:

Now that we have all the required values, plug them into the alternate form resulting in the equation as follows:

We can verify this result by comparing it with the exponent of 22 that we get when we do prime factorization of 11!11! as shown below:

The exponent of 22 is 88, which confirms that answer calculated by the alternate form is correct.

Applications of Legendre's theorem

Legendre's theorem is used to prove Kummer's theorem. In a special case, it is used to prove that 4 divides (2nn)\binom{2n}{n} where nn is a positive integer and not a power of 22.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved