back to table · edit · history · where entries came from · files · download
2654 bytes, as of the version from 2026-12-02 04:01 (current). Recorded here, not run.
"""Check all 451 decimal places supplied for C3 and C5 by the OEIS b-files.
Independent resolvent integrals, 1920 bits, T=1024; no primary roots/series.
"""
import json,pathlib,math,time,hashlib
from fractions import Fraction
from flint import arb,acb,ctx
import check_values as cv
W=pathlib.Path(__file__).resolve().parent
ctx.prec=1920;ctx.cap=16
T=1024;rows=[]
for m,name in [(3,'b224196.txt'),(5,'b243108.txt')]:
start=time.time();r=(m-1)//2;p=r+1
A=4*arb(4)**r/(arb.pi()*math.comb(2*r,r))
def integrand(t,analytic):
R=cv.resolvent_jet(1+t*t,r,analytic)
return acb('nan') if R is None else ((-1)**r)*R[r]
points=[0,1,2,4,8,16,32,64,128,256,512,1024];local=acb(0)
for l,h in zip(points,points[1:]):
part=acb.integral(integrand,l,h,rel_tol=arb('1e-480'),abs_tol=arb('1e-510'),
eval_limit=300000,depth_limit=50,deg_limit=700)
assert part.is_finite();local+=part
print('Source control',m,'segment',l,h,flush=True)
c=cv.POLYS[p].coeffs()
def remote(u,analytic):
v=1+u*u;w=1-u*u
P=sum((acb(cj)*v**j*w**(p+1-j) for j,cj in enumerate(c)),acb(0))
return 2*P*w**(2*p-3)/((2*u*u)**p*v**(2*p-1))
u=arb(T)/(arb(1+T*T).sqrt()+1)
tail=acb.integral(remote,acb(u),1,rel_tol=arb('1e-480'),abs_tol=arb('1e-510'),
eval_limit=300000,depth_limit=50,deg_limit=700)
raw=A*(local+tail);assert raw.imag.contains(0)
bound=A*16*arb(2)**r/arb(2).sqrt()*arb(T)**(-2*r-1)*(-arb(2).sqrt()*T).exp()
v=raw.real+arb(0,bound)
assert v.is_finite() and v.rel_accuracy_bits()>1500
digits=''.join(s.split()[1] for s in (W/name).read_text().splitlines()
if s.strip() and not s.startswith('#'))
# Both files begin with the first fractional digit, indexed zero.
lo=Fraction(int(digits),10**len(digits));ulp=Fraction(1,10**len(digits))
ok=bool(v.lower()>cv.rat(lo) and v.upper()<cv.rat(lo+ulp))
rows.append({'m':m,'file':name,'digits':len(digits),'decimal_places':len(digits),
'match':ok,'interval':cv.exact_bounds(v),'accuracy_bits':v.rel_accuracy_bits(),
'ball':str(v),'tail_error_bound':str(bound),'seconds':time.time()-start})
print('Source control',m,'all digits match',ok,'bits',v.rel_accuracy_bits(),flush=True)
out={'rows':rows,'working_bits':ctx.prec,'T':T,'failures':[r['m'] for r in rows if not r['match']],
'checker_sha256':hashlib.sha256(pathlib.Path(__file__).read_bytes()).hexdigest(),
'resolvent_checker_sha256':cv.CODE_HASH}
(W/'source-digit-results.json').write_text(json.dumps(out,indent=2)+'\n')
assert not out['failures']