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