cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A301275 Numerator of variance of first n primes.

This page as a plain text file.
%I A301275 #18 Oct 27 2019 11:12:55
%S A301275 0,1,7,59,64,581,649,2287,1001,2443,5669,17915,6665,36637,3529,22413,
%T A301275 22813,13065,75865,191819,58778,289013,7627,141973,5213,628001,370333,
%U A301275 96211,249436,381167,672727,1565639,453767,691587,1194917,301867,770294
%N A301275 Numerator of variance of first n primes.
%C A301275 Variance here is the sample variance unbiased estimator. - _Chai Wah Wu_, Mar 22 2018
%H A301275 Chai Wah Wu, <a href="/A301275/b301275.txt">Table of n, a(n) for n = 1..10000</a>
%H A301275 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 A301275 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 A301275 v := n -> 1/(n-1) * add((ithprime(i)  add(ithprime(j),j=1..n)/n)^2, i=1..n );
%p A301275 v1:= [0, seq(v(n),n=2..70)];
%t A301275 a[n_] := If[n == 1, 0, Variance[Prime[Range[n]]] // Numerator];
%t A301275 a /@ Range[100] (* _Jean-François Alcover_, Oct 27 2019 *)
%o A301275 (Python)
%o A301275 from fractions import Fraction
%o A301275 from sympy import prime
%o A301275 mu, variance = Fraction(prime(1)), Fraction(0)
%o A301275 A301275_list = [variance.numerator]
%o A301275 for i in range(2,10001):
%o A301275     datapoint = prime(i)
%o A301275     newmu = mu+(datapoint-mu)/i
%o A301275     variance = (variance*(i-2) + (datapoint-mu)*(datapoint-newmu))/(i-1)
%o A301275     mu = newmu
%o A301275     A301275_list.append(variance.numerator) # _Chai Wah Wu_, Mar 22 2018
%Y A301275 Mean and variance of primes: A301273/A301274, A301275/A301276, A301277, A273462.
%K A301275 nonn,frac
%O A301275 1,3
%A A301275 _N. J. A. Sloane_, Mar 18 2018