project-euler/251.py
2021-01-14 23:50:07 -06:00

22 lines
455 B
Python

from tqdm import tqdm
L = 110_000_000
v = dict()
print("loading a's")
for a in tqdm(range(1, L + 1)):
k = 8 * a**3 + 15 * a**2 + 6 * a - 1
v[k] = a
ct = 0
print("loading b's and c's")
for b in tqdm(range(1, L + 1)):
for c in tqdm(range(1, L + 1)):
if b + c > L: continue
k = 27 * b*b * c
if k in v:
a = v[k]
if a + b + c > L: continue
# res.add((v[k], b, c))
ct += 1