""" "Use the pi digit sequence as a tape LUT": store data as the OFFSET where it appears in pi, instead of the data itself. Test on REAL pi digits. Claim under test: the offset is ~the same size as the data, so nothing is saved. Reason: in a normal (random-looking) base-b sequence, an L-symbol string first appears near position b^L on average, so the offset needs ~L*log2(b) bits = exactly the data's size. Pointer-into-pi = base conversion = conservation. """ import mpmath, random, math D = 1_000_000 # decimal digits of pi to use as the tape mpmath.mp.dps = D + 20 s = mpmath.nstr(mpmath.mp.pi, D + 10, strip_zeros=False).replace("3.", "", 1).replace(".", "") s = s[:D] print(f"pi tape: {len(s)} decimal digits\n") random.seed(0) print(f"{'k (data digits)':>16}{'trials found':>14}{'avg 1st-occ pos':>18}" f"{'log10(pos)':>12}{'offset digits':>15}") print("-" * 76) for k in range(1, 7): positions = [] trials = 300 found = 0 for _ in range(trials): target = "".join(random.choice("0123456789") for _ in range(k)) idx = s.find(target) if idx >= 0: positions.append(idx + 1) # 1-based position found += 1 if positions: avg = sum(positions) / len(positions) off_digits = math.log10(avg) print(f"{k:>16}{found:>10}/{trials}{avg:>18.0f}{math.log10(avg):>12.2f}" f"{off_digits:>15.2f}") else: print(f"{k:>16}{found:>10}/{trials}{'(none in tape)':>18}") print("\nRead-off: 'offset digits' ~= 'k data digits' at every row -> the pointer into") print("pi is the SAME size as the data it points to. Base conversion, zero gain.") print("(k=6 needs ~10^6 positions ~ the whole 10^6-digit tape; beyond it you must") print(" extend pi further, and the offset only grows to match the data exactly.)")