Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #18 Oct 27 2019 11:12:55
%S 0,1,7,59,64,581,649,2287,1001,2443,5669,17915,6665,36637,3529,22413,
%T 22813,13065,75865,191819,58778,289013,7627,141973,5213,628001,370333,
%U 96211,249436,381167,672727,1565639,453767,691587,1194917,301867,770294
%N Numerator of variance of first n primes.
%C Variance here is the sample variance unbiased estimator. - _Chai Wah Wu_, Mar 22 2018
%H Chai Wah Wu, <a href="/A301275/b301275.txt">Table of n, a(n) for n = 1..10000</a>
%H Joel E. Cohen, <a href="http://lab.rockefeller.edu/cohenje/assets/file/415PrimesTwinPrimesTaylorsLawAmStatistician2016.pdf">Statistics of Primes (and Probably Twin Primes) Satisfy Taylor’s Law from Ecology</a>, The American Statistician, 70 (2016), 399-404.
%e The variances are 0, 1/2, 7/3, 59/12, 64/5, 581/30, 649/21, 2287/56, 1001/18, 2443/30, 5669/55, 17915/132, 6665/39, 36637/182, 3529/15, 22413/80, 22813/68, 13065/34, 75865/171, 191819/380, 58778/105, 289013/462, 7627/11, 141973/184, 5213/6, 628001/650, ...
%p v := n -> 1/(n-1) * add((ithprime(i) add(ithprime(j),j=1..n)/n)^2, i=1..n );
%p v1:= [0, seq(v(n),n=2..70)];
%t a[n_] := If[n == 1, 0, Variance[Prime[Range[n]]] // Numerator];
%t a /@ Range[100] (* _Jean-François Alcover_, Oct 27 2019 *)
%o (Python)
%o from fractions import Fraction
%o from sympy import prime
%o mu, variance = Fraction(prime(1)), Fraction(0)
%o A301275_list = [variance.numerator]
%o for i in range(2,10001):
%o datapoint = prime(i)
%o newmu = mu+(datapoint-mu)/i
%o variance = (variance*(i-2) + (datapoint-mu)*(datapoint-newmu))/(i-1)
%o mu = newmu
%o A301275_list.append(variance.numerator) # _Chai Wah Wu_, Mar 22 2018
%Y Mean and variance of primes: A301273/A301274, A301275/A301276, A301277, A273462.
%K nonn,frac
%O 1,3
%A _N. J. A. Sloane_, Mar 18 2018