Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download

William Stein -- Talk for Mathematics is a long conversation: a celebration of Barry Mazur

Views: 2342
@interact def f(n=4): a = (1+1/n)^n print N(a,1000) print N(e,1000)
Interact: please open in CoCalc
for X in [500000,1000000,..,3000000]: print X, prime_pi(X)
500000 41538 1000000 78498 1500000 114155 2000000 148933 2500000 183072 3000000 216816
prime_range(10010) ︠81ef287d-617b-431f-954b-afa2e8ab3660︠ show(sum(point3d([p/log(p),log(p),p], size=5) for p in primes(100)), frame=False) ︠3bba7d3c-6107-4a4a-9602-e8c815eb89d4︠ %python def err(X): n = 0 for p in prime_range(X): n += 1 if random() <= 0.01: if random() <=0.5: n -= 1 else: n += 1 return n - prime_pi(X)
%time err(X)
-61 CPU time: 0.18 s, Wall time: 0.18 s
X = 3000000 %time v = stats.TimeSeries([abs(err(X)) for i in range(100)])
CPU time: 18.68 s, Wall time: 18.68 s
︠f17e69d0-5dd5-4402-b57e-629f60f14d1a︠ v.plot_histogram()
v.mean(), N(sqrt(X))
(35.61, 1732.05080756888)