ITADN

Mushtak-Lemire script is buggy

#346Closedrsc 创建于 2025-12-16
R
rsccommented
The end of https://github.com/fastfloat/fast_float/blob/main/script/mushtak_lemire.py reads: ``` # Enumerate through all the convergents of T[q] / 2^137 with denominators < 2^64 found_solution = False for j, tq in enumerate(all_tqs): for _, w in convergents(continued_fraction(tq, 2 ** 137)): if w >= 2 ** 64: break if (tq * w) % 2 ** 137 > 2 ** 137 - 2 ** 64: print(f"SOLUTION: q={j-342} T[q]={tq} w={w}") found_solution = True if not found_solution: print("No solutions!") ``` The indentation is incorrect after the break - the counterexample check is entirely unreachable - so this script would never print a counterexample even if one existed. (Happily, no counterexample exists, so the script will continue to print 'No solutions!' even after fixing the indentation.)
关闭于 2025-12-17 2 条评论