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.

A301276 Denominator of variance of first n primes.

This page as a plain text file.
%I A301276 #18 Jun 20 2025 01:23:46
%S A301276 1,2,3,12,5,30,21,56,18,30,55,132,39,182,15,80,68,34,171,380,105,462,
%T A301276 11,184,6,650,351,84,203,290,465,992,264,374,595,140,333,1406,741,520,
%U A301276 205,574,903,1892,495,230,1081,2256,588,2450,1275,884,13,318,1485
%N A301276 Denominator of variance of first n primes.
%C A301276 Variance here is the sample variance unbiased estimator. - _Chai Wah Wu_, Mar 22 2018
%H A301276 Chai Wah Wu, <a href="/A301276/b301276.txt">Table of n, a(n) for n = 1..10000</a>
%H A301276 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 A301276 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 A301276 v := n -> 1/(n-1) * add((ithprime(i) add(ithprime(j),j=1..n)/n)^2, i=1..n );
%p A301276 v1:= [0, seq(v(n),n=2..70)];
%t A301276 a[n_] := If[n == 1, 1, Variance[Prime[Range[n]]] // Denominator];
%t A301276 a /@ Range[100] (* _Jean-François Alcover_, Oct 27 2019 *)
%o A301276 (Python)
%o A301276 from fractions import Fraction
%o A301276 from sympy import prime
%o A301276 mu, variance = Fraction(prime(1)), Fraction(0)
%o A301276 A301276_list = [variance.denominator]
%o A301276 for i in range(2,10001):
%o A301276     datapoint = prime(i)
%o A301276     newmu = mu+(datapoint-mu)/i
%o A301276     variance = (variance*(i-2) + (datapoint-mu)*(datapoint-newmu))/(i-1)
%o A301276     mu = newmu
%o A301276     A301276_list.append(variance.denominator) # _Chai Wah Wu_, Mar 22 2018
%Y A301276 Mean and variance of primes: A301273/A301274, A301275/A301276, A301277, A273462.
%K A301276 nonn,frac
%O A301276 1,2
%A A301276 _N. J. A. Sloane_, Mar 18 2018