prime number theorem error term

830 days ago by wstein

def pr_log(xmax): y = float(0) v = [y] for p in prime_range(xmax): y += 1r x = float(p) v.append((y-x/math.log(x))/(math.log(x)*math.sqrt(x))) return v 
       
time v_log = pr_log(10^7) T_log = finance.TimeSeries(v_log[2:]) 
       
Time: CPU 1.96 s, Wall: 1.98 s
Time: CPU 1.96 s, Wall: 1.98 s
T_log 
       
[-0.3840, -0.0296, 0.0782, 0.0519, 0.1007 ... 0.8664, 0.8664, 0.8664,
0.8664, 0.8664]
[-0.3840, -0.0296, 0.0782, 0.0519, 0.1007 ... 0.8664, 0.8664, 0.8664, 0.8664, 0.8664]
def pr_Li(xmax): y = float(0) v = [y] for p in prime_range(xmax): y += 1r x = float(p) v.append((y-float(Li(x)))/(math.log(x)*math.sqrt(x))) return v 
       
time v = pr_Li(10^5) T = finance.TimeSeries(v[2:]) 
       
Time: CPU 6.69 s, Wall: 6.89 s
Time: CPU 6.69 s, Wall: 6.89 s
       
[0.4633, 0.1141, 0.0560, -0.0686, -0.0380 ... -0.0095, -0.0100, -0.0100,
-0.0101, -0.0099]
[0.4633, 0.1141, 0.0560, -0.0686, -0.0380 ... -0.0095, -0.0100, -0.0100, -0.0101, -0.0099]
T.plot_histogram(bins=5000).show(xmax=0,frame=True) 
       
time v = pr_Li(10^6) T = finance.TimeSeries(v[2:]) 
       
Time: CPU 58.29 s, Wall: 60.19 s
Time: CPU 58.29 s, Wall: 60.19 s
       
[0.4633, 0.1141, 0.0560, -0.0686, -0.0380 ... -0.0093, -0.0093, -0.0092,
-0.0093, -0.0092]
[0.4633, 0.1141, 0.0560, -0.0686, -0.0380 ... -0.0093, -0.0093, -0.0092, -0.0093, -0.0092]
T.min() 
       
-0.09275610952168295
-0.09275610952168295
T[4:].min() 
       
-0.09275610952168295
-0.09275610952168295
T.plot_histogram(bins=5000).show(xmax=0,frame=True) 
       
T.plot_histogram(bins=5000).show(xmin=-0.03, xmax=0,frame=True) 
       
T[1000:].plot_histogram(bins=5000).show(xmax=0,frame=True) 
       
prime_pi(10^5) 
       
9592
9592
len(T) 
       
78497
78497
T[10000:].plot_histogram(bins=1000).show(xmax=0,frame=True) 
       
T[50000:].plot_histogram(bins=1000).show(xmax=0,frame=True) 
       
T[50000:].plot_histogram(bins=100).show(xmax=0,frame=True) 
       
T[50000:].plot_histogram(bins=2000).show(xmax=0,frame=True) 
       
T[70000:].plot_histogram(bins=300).show(xmax=0,frame=True)