Solved 72 in Python.
This commit is contained in:
@@ -46,6 +46,11 @@ def relative_primes_count_naiv(n):
|
||||
|
||||
|
||||
def relative_primes_count_factors(n, fs):
|
||||
"""
|
||||
XXX: this method has a bug that first occurs for n = 60. Use totient
|
||||
function from e072.py instead! For some curious reason it is good enough
|
||||
for this problem. Probably because we only deal with two factors ever.
|
||||
"""
|
||||
from itertools import combinations
|
||||
rel_primes_count = n - 1 # n itself is not a relative prime
|
||||
for f in fs:
|
||||
|
||||
Reference in New Issue
Block a user