Maths WorkshopMaths problems with full solutions
Exercise 1960Number theory › PrimesOlympiadAdded 4 Nov 2026

An integrality proof by Legendre's formula

#Legendre's formula#floor function#integrality

Statement

Recall Legendre's formula: vp(n!)=∑k≥1⌊npk⌋v_p(n!)=\sum_{k\ge1}\left\lfloor\frac n{p^k}\right\rfloor.

1. How many zeros are at the end of the decimal expansion of 2024!2024!?
2. Prove that for all non-negative integers m,nm,n, the number
(2m)! (2n)!m! n! (m+n)!\frac{(2m)!\,(2n)!}{m!\,n!\,(m+n)!}
is an integer.

Hint

For part 2, prove ⌊2x⌋+⌊2y⌋≥⌊x⌋+⌊y⌋+⌊x+y⌋\lfloor2x\rfloor+\lfloor2y\rfloor\ge\lfloor x\rfloor+\lfloor y\rfloor+\lfloor x+y\rfloor for real x,yx,y.

Show solutionHide solution

Solution

1. The number of trailing zeros is min⁡(v2,v5)\min(v_2,v_5) of 2024!2024!, and v5≤v2v_5\le v_2 because ⌊2024/5k⌋≤⌊2024/2k⌋\lfloor 2024/5^k\rfloor\le\lfloor 2024/2^k\rfloor for every kk. So
v5(2024!)=⌊20245⌋+⌊202425⌋+⌊2024125⌋+⌊2024625⌋=404+80+16+3=503.v_5(2024!)=\left\lfloor\frac{2024}5\right\rfloor+\left\lfloor\frac{2024}{25}\right\rfloor+\left\lfloor\frac{2024}{125}\right\rfloor+\left\lfloor\frac{2024}{625}\right\rfloor=404+80+16+3=503.

2. Floor inequality. Write x=a+αx=a+\alpha, y=b+βy=b+\beta with a,b∈Za,b\in\mathbb{Z}, α,β∈[0,1)\alpha,\beta\in[0,1). The inequality becomes
⌊2α⌋+⌊2β⌋≥⌊α+β⌋.\lfloor2\alpha\rfloor+\lfloor2\beta\rfloor\ge\lfloor\alpha+\beta\rfloor.
If α+β<1\alpha+\beta<1 the right side is 00. If α+β≥1\alpha+\beta\ge1 then one of α,β\alpha,\beta is at least 12\frac12, so the left side is at least 11, and the right side is exactly 11 (since α+β<2\alpha+\beta<2).

Integrality. For each prime pp, by Legendre's formula,
vp(expression)=∑k≥1(⌊2mpk⌋+⌊2npk⌋−⌊mpk⌋−⌊npk⌋−⌊m+npk⌋)≥0v_p(\text{expression})=\sum_{k\ge1}\left(\left\lfloor\frac{2m}{p^k}\right\rfloor+\left\lfloor\frac{2n}{p^k}\right\rfloor-\left\lfloor\frac m{p^k}\right\rfloor-\left\lfloor\frac n{p^k}\right\rfloor-\left\lfloor\frac{m+n}{p^k}\right\rfloor\right)\ge0
by the inequality with x=mpkx=\frac m{p^k}, y=npky=\frac n{p^k}. All the valuations are non-negative, so the number is an integer.

Check. (m,n)=(1,1)(m,n)=(1,1): 2⋅21⋅1⋅2=2\frac{2\cdot2}{1\cdot1\cdot2}=2; (2,3)(2,3): 24⋅7202⋅6⋅120=12\frac{24\cdot720}{2\cdot6\cdot120}=12 ✓.

Remark. These are the "super Catalan numbers". The case m=nm=n gives (2nn)\binom{2n}n.

Lesson. To prove that a quotient of factorials is an integer, compare prime by prime using Legendre's formula, and reduce to an elementary inequality for floor functions.