You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 jaren geleden
12345678910111213141516171819202122
  1. from collections import defaultdict
  2. from itertools import count
  3. def divisors(N):
  4. ds = {1, N}
  5. for n in range(2, int(N**0.5) + 1):
  6. if N % n == 0:
  7. ds.update({n, N // n})
  8. return ds
  9. lim = int(text)
  10. ans1, ans2 = None, None
  11. n = 830_000
  12. while ans1 is None or ans2 is None:
  13. ds = divisors(n)
  14. if ans1 is None and sum(ds) > lim // 10:
  15. ans1 = n
  16. if ans2 is None and sum(d for d in ds if n // d <= 50) > lim // 11:
  17. ans2 = n
  18. n += 1