Zulip Chat Archive

Stream: Is there code for X?

Topic: Sylvester-Schur: p-adic valuation


J. J. Issai (project started by GRP) (Jun 20 2025 at 18:22):

over in #new members > Working on a project: Sylvester-Schur I have started a query. I am interested in code for Legendre's formula for the exact power of a prime p dividing factorial n, namely νp(n!)=e>0n/pe\nu_p(n!) = \sum_{e>0} \lfloor n/p^e \rfloor . Can someone help me find this in Mathlib?

I would also like to see how this is used in Lean proofs, so that I can prove (or find in Mathlib) two other items referenced in the new members thread: Law of Ademption and Fundamental Inequality.
GRP 2025.06.20.

Jz Pan (Jun 20 2025 at 19:27):

Nat.Prime.emultiplicity_factorial or Nat.Prime.pow_dvd_factorial_iff or padicValNat_factorial

It's unfortunate that νp\nu_p has several spellings in mathlib.

J. J. Issai (project started by GRP) (Jun 20 2025 at 19:36):

Jz Pan: Thanks! I'll go check those out. GRP 2025.06.20.

J. J. Issai (project started by GRP) (Jun 22 2025 at 20:48):

@Jz Pan Thanks again. (Still learning Zulip interface.)


Last updated: Dec 20 2025 at 21:32 UTC