Skip to content

Prime Exponents and LTE

Updated Β· Equations updated; Sections updated; Examples or practice updated; Explanations expanded What changed?
  1. β€” Equations updated; Sections updated; Examples or practice updated; Explanations expanded

For a prime pp and a nonzero integer nn, the valuation vp(n)v_p(n) is the exponent of pp in the prime factorization of ∣n∣\lvert n\rvert. For example, 72=23β‹…3272=2^3\cdot3^2, so v2(72)=3v_2(72)=3 and v3(72)=2v_3(72)=2. Set vp(0)=∞v_p(0)=\infty when needed.

Products and powers become addition and multiplication of exponents:

vp(ab)=vp(a)+vp(b),vp(ak)=kvp(a).v_p(ab)=v_p(a)+v_p(b),\qquad v_p(a^k)=kv_p(a).

For nonzero rationals, define vp(a/b)=vp(a)βˆ’vp(b)v_p(a/b)=v_p(a)-v_p(b). For sums, we only have

vp(a+b)β‰₯min⁑(vp(a),vp(b)),v_p(a+b)\ge\min(v_p(a),v_p(b)),

with equality if the two valuations differ. Equal valuations can allow extra cancellation, so valuations do not distribute over addition.

Example. Find the largest power of two dividing 24β‹…40324\cdot40^3.

Since v2(24)=3v_2(24)=3 and v2(40)=3v_2(40)=3,

v2(24β‹…403)=3+3β‹…3=12.v_2(24\cdot40^3)=3+3\cdot3=12.

The largest power is 2122^{12}, meaning 2122^{12} divides the number but 2132^{13} does not.


In n!n!, every multiple of pp contributes a factor of pp, every multiple of p2p^2 contributes another, and so on. This gives Legendre’s formula:

vp(n!)=βˆ‘jβ‰₯1⌊npjβŒ‹.v_p(n!)=\sum_{j\ge1}\left\lfloor\frac n{p^j}\right\rfloor.

The sum is finite because the terms become zero once pj>np^j>n.

Example. Find the number of trailing decimal zeros in 100!100!.

A zero needs a factor of ten, so its count is min⁑(v2(100!),v5(100!))\min(v_2(100!),v_5(100!)). There are more factors of two than five, and

v5(100!)=⌊1005βŒ‹+⌊10025βŒ‹=20+4=24.v_5(100!)=\left\lfloor\frac{100}5\right\rfloor+\left\lfloor\frac{100}{25}\right\rfloor=20+4=24.

Thus 100!100! ends in exactly 2424 zeros.

For base b=∏pieib=\prod p_i^{e_i}, the number of trailing base-bb zeros is min⁑i⌊vpi(N)/eiβŒ‹\min_i\lfloor v_{p_i}(N)/e_i\rfloor. Dividing by the base exponents is essential for bases such as twelve or one hundred.


Use the factorial definition to subtract valuations:

vp((nk))=vp(n!)βˆ’vp(k!)βˆ’vp((nβˆ’k)!).v_p\left(\binom nk\right)=v_p(n!)-v_p(k!)-v_p((n-k)!).

This determines prime divisibility without calculating the binomial coefficient itself.

Example. Find the exponent of two in (2010)\binom{20}{10}.

Legendre gives v2(20!)=10+5+2+1=18v_2(20!)=10+5+2+1=18 and v2(10!)=5+2+1=8v_2(10!)=5+2+1=8. Therefore

v2((2010))=18βˆ’2(8)=2.v_2\left(\binom{20}{10}\right)=18-2(8)=2.

The binomial coefficient is divisible by four but not eight.


The lifting-the-exponent lemma, or LTE, finds the exact valuation of certain differences of powers. If pp is an odd prime, p∣aβˆ’bp\mid a-b, p∀abp\nmid ab, and nβ‰₯1n\ge1, then

vp(anβˆ’bn)=vp(aβˆ’b)+vp(n).v_p(a^n-b^n)=v_p(a-b)+v_p(n).

Assume the difference is nonzero when asking for a finite exponent. The lemma says that once a,ba,b agree modulo pp and neither contains a factor of pp, raising to the nnth power adds exactly the exponent of pp in nn.

For odd nn, replacing bb by βˆ’b-b gives the sum version:

vp(an+bn)=vp(a+b)+vp(n),v_p(a^n+b^n)=v_p(a+b)+v_p(n),

provided p∣a+bp\mid a+b and p∀abp\nmid ab. The oddness of nn is required for this rewrite.

Example. Find the largest exponent ee such that 3e∣1054βˆ’13^e\mid10^{54}-1.

The prime three is odd, 3∣10βˆ’13\mid10-1, and 3∀10β‹…13\nmid10\cdot1. Thus LTE applies:

e=v3(1054βˆ’1)=v3(9)+v3(54)=2+3=5.e=v_3(10^{54}-1)=v_3(9)+v_3(54)=2+3=5.

Example. Find v3(281+1)v_3(2^{81}+1).

Here 8181 is odd, 3∣2+13\mid2+1, and 3∀23\nmid2. The sum version gives

v3(281+1)=v3(3)+v3(81)=1+4=5.v_3(2^{81}+1)=v_3(3)+v_3(81)=1+4=5.

For odd integers a,ba,b, the two-adic formulas depend on the exponent’s parity. If nn is odd,

v2(anβˆ’bn)=v2(aβˆ’b).v_2(a^n-b^n)=v_2(a-b).

If nn is even,

v2(anβˆ’bn)=v2(aβˆ’b)+v2(a+b)+v2(n)βˆ’1.v_2(a^n-b^n)=v_2(a-b)+v_2(a+b)+v_2(n)-1.

For odd nn, we also have v2(an+bn)=v2(a+b)v_2(a^n+b^n)=v_2(a+b). For even nn and odd a,ba,b, each even power is one modulo eight, so v2(an+bn)=1v_2(a^n+b^n)=1.

Example. Find v2(320βˆ’1)v_2(3^{20}-1).

Both bases are odd and the exponent is even, so

v2(320βˆ’1)=v2(2)+v2(4)+v2(20)βˆ’1=1+2+2βˆ’1=4.v_2(3^{20}-1)=v_2(2)+v_2(4)+v_2(20)-1=1+2+2-1=4.

Using the odd-prime formula would incorrectly give three.

Write a=prua=p^ru and b=psvb=p^sv with p∀uvp\nmid uv. If r<sr<s, then

a+b=pr(u+psβˆ’rv),a+b=p^r(u+p^{s-r}v),

and the factor in parentheses is not divisible by pp. Therefore vp(a+b)=rv_p(a+b)=r. If r=sr=s, the unit terms may cancel modulo pp and create extra powers. This proves the unequal-valuation rule and explains why equal valuations need more information.

The same argument applies to a difference. It is useful before LTE: sometimes the two terms already have unequal valuations, so the answer is immediate and lifting is unnecessary.

Example. Find v3(620βˆ’920)v_3(6^{20}-9^{20}).

The two valuations are twenty and forty. Because they differ, the difference has valuation twenty. Equivalently,

620βˆ’920=320(220βˆ’320),6^{20}-9^{20}=3^{20}(2^{20}-3^{20}),

and the parenthetical factor is not divisible by three.


Let sp(n)s_p(n) be the sum of the base-pp digits of nn. Legendre’s formula can be rewritten as

vp(n!)=nβˆ’sp(n)pβˆ’1.v_p(n!)=\frac{n-s_p(n)}{p-1}.

To derive it, write n=βˆ‘jdjpjn=\sum_jd_jp^j. The floor sum counts a digit djd_j with total weight 1+p+β‹―+pjβˆ’1=(pjβˆ’1)/(pβˆ’1)1+p+\cdots+p^{j-1}=(p^j-1)/(p-1). Summing the contributions gives the formula.

The digit version is especially useful for powers of the base or for differences of factorial valuations, where the large linear terms cancel.

Example. Find the exponent of two in (10050)\binom{100}{50}.

The binary digit sums are s2(100)=3s_2(100)=3 and s2(50)=3s_2(50)=3. Therefore

v2(10050)=(100βˆ’3)βˆ’2(50βˆ’3)=3.v_2\binom{100}{50} =(100-3)-2(50-3)=3.

The coefficient is divisible by eight but not sixteen. No factorial or binomial coefficient needs to be evaluated.

For base pp, the general binomial valuation becomes

vp(nk)=sp(k)+sp(nβˆ’k)βˆ’sp(n)pβˆ’1.v_p\binom nk=\frac{s_p(k)+s_p(n-k)-s_p(n)}{p-1}.

Every carry in adding kk and nβˆ’kn-k reduces the combined digit sum by pβˆ’1p-1, including carries propagated through several positions. Thus this valuation equals the number of carries. This is Kummer’s theorem, with the carry interpretation derived directly from Legendre.


The factorial form of a Catalan number is Cn=(2n)!/[n!(n+1)!]C_n=(2n)!/[n!(n+1)!]. Applying the binary digit formula and using s2(2n)=s2(n)s_2(2n)=s_2(n) gives

v2(Cn)=s2(n+1)βˆ’1.v_2(C_n)=s_2(n+1)-1.

A positive integer has binary digit sum one exactly when it is a power of two. Consequently, CnC_n is odd exactly when n=2rβˆ’1n=2^r-1 for some rβ‰₯0r\ge0.

Example. Determine whether C31C_{31} and C32C_{32} are odd, and find their exact powers of two.

For n=31n=31, the number n+1=32n+1=32 has one binary one, so v2(C31)=0v_2(C_{31})=0 and the Catalan number is odd.

For n=32n=32, the number n+1=33n+1=33 has two binary ones, so v2(C32)=1v_2(C_{32})=1. It is even but not divisible by four.

This is a useful example of a structural answer replacing a large calculation. The numerical values of the Catalan numbers are irrelevant to their parity.


Assume pp is odd, p∣aβˆ’bp\mid a-b, and p∀abp\nmid ab. First suppose the exponent mm is not divisible by pp. Factoring a difference of powers gives

amβˆ’bmaβˆ’b=amβˆ’1+amβˆ’2b+β‹―+bmβˆ’1≑mbmβˆ’1≑̸0(modp).\frac{a^m-b^m}{a-b}=a^{m-1}+a^{m-2}b+\cdots+b^{m-1} \equiv mb^{m-1}\not\equiv0\pmod p.

Thus raising to an exponent prime to pp adds no new valuation.

Next consider exponent pp. Write a=b+ha=b+h with vp(h)=rβ‰₯1v_p(h)=r\ge1. In the binomial expansion of (b+h)pβˆ’bp(b+h)^p-b^p, the first term pbpβˆ’1hpb^{p-1}h has valuation r+1r+1. Every other term has valuation at least r+2r+2: the intermediate binomial coefficients contain pp, and the final term hph^p has valuation prβ‰₯r+2pr\ge r+2.

The unequal-valuation principle therefore gives

vp(apβˆ’bp)=r+1.v_p(a^p-b^p)=r+1.

Finally write n=ptmn=p^tm with p∀mp\nmid m. The first step preserves the original valuation, and each of the tt exponent-pp steps adds one. Hence vp(anβˆ’bn)=vp(aβˆ’b)+tv_p(a^n-b^n)=v_p(a-b)+t.

The proof also explains the exceptional behavior at two: the final binomial term may tie the first term’s valuation rather than lying strictly above it, permitting additional cancellation.


If p∀aβˆ’bp\nmid a-b, the lemma’s difference form does not apply. An order calculation or a parity condition may let us group powers so that the new bases do agree modulo pp.

If both bases contain pp, remove the common prime-power factor first. LTE concerns unit bases, not arbitrary multiples of the prime.

Example. Find v3(620βˆ’1220)v_3(6^{20}-12^{20}).

Factor the common term:

620βˆ’1220=620(1βˆ’220).6^{20}-12^{20}=6^{20}(1-2^{20}).

The first factor has valuation twenty. For the second, write 220βˆ’1=410βˆ’12^{20}-1=4^{10}-1. Now three divides 4βˆ’14-1 and divides neither base, so LTE gives

v3(410βˆ’1)=v3(3)+v3(10)=1.v_3(4^{10}-1)=v_3(3)+v_3(10)=1.

The total valuation is twenty-one. Applying LTE directly to bases six and twelve would violate the coprimality hypothesis.


When a target divisor contains several prime powers, translate each into a valuation inequality. The least exponent must satisfy all resulting divisibility conditions simultaneously.

Example. Find the smallest positive nn such that 37112∣10nβˆ’13^7 11^2\mid10^n-1.

For three, LTE applies directly:

v3(10nβˆ’1)=2+v3(n).v_3(10^n-1)=2+v_3(n).

Thus 35∣n3^5\mid n.

Modulo eleven, ten is negative one, so nn must be even. Write n=2tn=2t and apply LTE to 100tβˆ’1100^t-1:

v11(100tβˆ’1)=v11(99)+v11(t)=1+v11(t).v_{11}(100^t-1)=v_{11}(99)+v_{11}(t)=1+v_{11}(t).

Therefore eleven divides tt, equivalently twenty-two divides nn. Combining the conditions gives

nmin⁑=lcm⁑(35,22)=5346.n_{\min}=\operatorname{lcm}(3^5,22)=5346.

Both valuation inequalities hold at this value, so the necessary conditions are also sufficient.

A single prime condition may force a preliminary rewrite before another theorem becomes usable. Here parity determined the exponent form before the eleven-adic calculation. Establish that information in the solution rather than applying a formula with an unresolved parity parameter.


If an equation asserts that an expression is a perfect kkth power, every finite prime valuation must be a multiple of kk. Finding one prime whose valuation is forced into the wrong residue class rules out the equation.

For example, for positive odd nn, the formula v3(2n+1)=1+v3(n)v_3(2^n+1)=1+v_3(n) immediately rules out a square whenever v3(n)v_3(n) is even. This is a conditional obstruction, not a full classification: if the valuation is even, other primes may still prevent a square.


For kβ‰₯3k\ge3, the congruence x2≑1(mod2k)x^2\equiv1\pmod{2^k} has four solutions:

x≑1,βˆ’1,1+2kβˆ’1,βˆ’1+2kβˆ’1(mod2k).x\equiv1,-1,1+2^{k-1},-1+2^{k-1}\pmod{2^k}.

To prove completeness, xx must be odd. The factors xβˆ’1,x+1x-1,x+1 are consecutive even numbers, so one has valuation exactly one and the other has valuation at least two. Their product has valuation at least kk only if the second factor has valuation at least kβˆ’1k-1.

Thus x≑1x\equiv1 or negative one modulo 2kβˆ’12^{k-1}, giving the four classes above modulo 2k2^k. Squaring each class verifies that it works.

For modulus sixty-four, the solutions are one, thirty-one, thirty-three, sixty-three. This differs from an odd prime power, which has only the two sign roots. The exceptional two-adic LTE formula reflects the same split between the valuations of xβˆ’1x-1 and x+1x+1.


Sometimes the question asks for the smallest factorial containing a required prime power. The valuation is nondecreasing in nn but may jump by more than one at a multiple of a high prime power.

Example. Find the smallest nn such that 320∣n!3^{20}\mid n!.

Legendre gives

v3(44!)=14+4+1=19,v3(45!)=15+5+1=21.v_3(44!)=14+4+1=19,\qquad v_3(45!)=15+5+1=21.

The valuation is nondecreasing, so every earlier factorial has valuation below twenty, while forty-five factorial has enough. The smallest nn is forty-five.

There is no factorial valuation equal to twenty at this transition. Searching for equality rather than the inequality would miss the correct threshold.

For larger targets, a monotone search can bracket the smallest nn. The approximation vp(n!)<n/(pβˆ’1)v_p(n!)<n/(p-1) supplies a quick necessary lower bound, while the exact floor sum settles the final neighboring values.


For several nonzero terms, if exactly one term has the smallest pp-valuation, their sum has that same valuation. Factor out the common smallest power; one remaining term is a unit modulo pp and all others are divisible by pp.

This gives an impossibility test for rational sums. A rational number is an integer only if all its prime valuations are nonnegative.

Example. Prove that 2βˆ’a+3βˆ’b+5βˆ’c2^{-a}+3^{-b}+5^{-c} is not an integer when a,b,ca,b,c are positive integers.

At the prime two, the valuations of the three summands are βˆ’a,0,0-a,0,0. The smallest valuation is unique, so the sum has valuation βˆ’a<0-a<0. Therefore it cannot be an integer.

This proof avoids a large common denominator and identifies exactly which prime obstructs integrality. If two least valuations tied, cancellation could occur and a further argument would be needed.


A base-zero count compares each available prime exponent with the number required for one copy of the base. The scarcest raw prime exponent need not be the bottleneck after this division.

For 100!100!, Legendre gives v2=97v_2=97 and v3=48v_3=48. In base 72=233272=2^3 3^2, the trailing-zero count is

min⁑(⌊973βŒ‹,⌊482βŒ‹)=24.\min\left(\left\lfloor\frac{97}{3}\right\rfloor, \left\lfloor\frac{48}{2}\right\rfloor\right)=24.

Each zero consumes three twos and two threes. Counting only factors of the largest prime, as in ordinary decimal factorial problems, would not be justified for an arbitrary base.


For a prime pp and 1≀k≀pβˆ’11\le k\le p-1, the numerator of (pk)=p!/[k!(pβˆ’k)!]\binom pk=p!/[k!(p-k)!] contains exactly one factor of pp and neither denominator factorial contains one. Hence vp(pk)=1v_p\binom pk=1.

Applying the binomial theorem gives

(a+b)p≑ap+bp(modp)(a+b)^p\equiv a^p+b^p\pmod p

for integers a,ba,b. Every middle coefficient vanishes modulo the prime. This congruence does not generally hold modulo p2p^2, because those coefficients have valuation exactly one rather than at least two.

The valuation calculation therefore explains both the useful congruence and its limitation at the next prime power.