A classical formula of Legendre gives the p-adic valuation for factorials
as a finite sum of values of the floor function. This expression can be
used to produce a formula for the p-adic valuation of n as a finite
sum of periodic functions. An analogous result is established for the
p-adic valuation of the ASM
numbers. This sequence counts the number of
alternating sign matrices.