Skip to content

Instantly share code, notes, and snippets.

@igorvanloo
Created May 16, 2022 16:13
Show Gist options
  • Save igorvanloo/1f7cdcc9531c3bd3f639b0feabd1eb57 to your computer and use it in GitHub Desktop.
Save igorvanloo/1f7cdcc9531c3bd3f639b0feabd1eb57 to your computer and use it in GitHub Desktop.
Legendres Formula
def legendre_factorial(x):
primes = list_primes(a)
prime_fac = {}
for y in primes:
total = 0
for i in range(1, int(math.floor(math.log(x, y))) + 1):
total += int(math.floor(x / (y ** i)))
prime_fac[y] = total
return prime_fac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment