Solved 72 in Python.

This commit is contained in:
2019-08-01 18:28:53 -04:00
parent 8b1a4fa6ef
commit 4c93d34c26
3 changed files with 120 additions and 2 deletions

View File

@@ -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: