first commit

This commit is contained in:
=
2024-02-07 15:06:50 +01:00
commit af02e453c1
55 changed files with 2166 additions and 0 deletions

Binary file not shown.

21
p12/solution.py Normal file
View File

@@ -0,0 +1,21 @@
from util.sieve import extended_sieve as sieve
from util.prod import prod
def solution(n):
i = 1
max_factors = 1
s = sieve()
while True:
i += 1
p_dec_0 = s.get(i)[1]
p_dec_1 = s.get(i+1)[1]
n_factors_0 = prod([p_dec_0[key]+1 if key != 2 else p_dec_0[key] for key in p_dec_0])
n_factors_1 = prod([p_dec_1[key]+1 if key != 2 else p_dec_1[key] for key in p_dec_1])
n_factors_product = n_factors_0 * n_factors_1
if n_factors_product > max_factors:
max_factors = n_factors_product
print(max_factors)
if n_factors_product > n:
return i*(i+1)/2, n_factors_product
print(solution(500))