Created
August 27, 2012 19:00
-
-
Save mmourafiq/3491358 to your computer and use it in GitHub Desktop.
multiplicities of prime factors less than x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_primes_multiplicities(x): | |
""" | |
Returns factors for x! | |
""" | |
p_multi = {}#factors multiplicities | |
for p in primes_less(x): | |
temp = x | |
mult = 0 | |
while temp!= 0: | |
temp /= p | |
mult += temp | |
p_multi[p] = mult | |
return p_multi | |
def nbr_factors(x): | |
nbr = 0 | |
for f in get_primes_multiplicities(x).values(): | |
nbr += (f + 1) | |
return nbr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment