Fix Day23 solve

This commit is contained in:
Roman Hergenreder 2023-12-26 15:33:18 +01:00
parent ab7d3f8f8c
commit bfa7d360fb

@ -38,10 +38,10 @@ N = values["N"]
hint = values["hint"] hint = values["hint"]
p = None p = None
q = var("q", domain="integer") q = var("q")
for x in range(0,1000+1): for x in range(0,1000+1):
eq = (N/q)^3 - q^8 + y_x(x=x) == hint eq = (N/q)^3 - q^8 + y_x(x=x) == hint
solution = solve([eq], q, solution_dict=True) solution = solve(eq, q, solution_dict=True)
if solution and q in solution[0]: if solution and q in solution[0]:
print("[+] Found x:", x) print("[+] Found x:", x)
q = int(solution[0][q]) q = int(solution[0][q])