Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

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

3999 views
def prime_g(B): """ Compute the numbers g(p) for all primes p <= B, as a time series. These are the numbers g(p)=(next_prime(p)-p)/p, which are numbers between 0 and 1. """ from math import log, sqrt v = [float(p) for p in prime_range(next_prime(B)+1)] # primes less than B and one more. return stats.TimeSeries([(v[i+1]-v[i])/sqrt(log(v[i])) for i in range(len(v)-1)])
%time t = prime_g(10^7); t
[1.2011, 1.9081, 1.5765, 2.8675, 1.2916 ... 1.4945, 6.9743, 0.4982, 4.4835, 6.9743] CPU time: 1.07 s, Wall time: 1.08 s
%time show(t.plot_histogram(bins=1000))
CPU time: 1.83 s, Wall time: 1.74 s
show(t.plot_histogram(bins=1000),xmax=13)
%time t = prime_g(10^8); t
[1.2011, 1.9081, 1.5765, 2.8675, 1.2916 ... 2.3300, 4.1939, 2.7959, 4.1939, 4.1939] CPU time: 9.14 s, Wall time: 9.14 s
%time show(t.plot_histogram(bins=1000))
CPU time: 1.73 s, Wall time: 1.64 s
show(t.plot_histogram(bins=1000),xmax=13)
show(t.plot_histogram(bins=3000),xmax=13)
%time t = prime_g(10^9); t
[1.2011, 1.9081, 1.5765, 2.8675, 1.2916 ... 18.8916, 2.1967, 7.9081, 1.7574, 15.3769] CPU time: 83.72 s, Wall time: 83.72 s
%time show(t.plot_histogram(bins=2000))
CPU time: 6.02 s, Wall time: 5.92 s
show(t.plot_histogram(bins=4000),xmax=13)