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.

Original entry on oeis.org

1, 2, 3, 12, 5, 30, 21, 56, 18, 30, 55, 132, 39, 182, 15, 80, 68, 34, 171, 380, 105, 462, 11, 184, 6, 650, 351, 84, 203, 290, 465, 992, 264, 374, 595, 140, 333, 1406, 741, 520, 205, 574, 903, 1892, 495, 230, 1081, 2256, 588, 2450, 1275, 884, 13, 318, 1485
Offset: 1

Views

Author

N. J. A. Sloane, Mar 18 2018

Keywords

Comments

Variance here is the sample variance unbiased estimator. - Chai Wah Wu, Mar 22 2018

Examples

			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, ...
		

Crossrefs

Mean and variance of primes: A301273/A301274, A301275/A301276, A301277, A273462.

Programs

  • Maple
    v := n -> 1/(n-1) * add((ithprime(i) add(ithprime(j),j=1..n)/n)^2, i=1..n );
    v1:= [0, seq(v(n),n=2..70)];
  • Mathematica
    a[n_] := If[n == 1, 1, Variance[Prime[Range[n]]] // Denominator];
    a /@ Range[100] (* Jean-François Alcover, Oct 27 2019 *)
  • Python
    from fractions import Fraction
    from sympy import prime
    mu, variance = Fraction(prime(1)), Fraction(0)
    A301276_list = [variance.denominator]
    for i in range(2,10001):
        datapoint = prime(i)
        newmu = mu+(datapoint-mu)/i
        variance = (variance*(i-2) + (datapoint-mu)*(datapoint-newmu))/(i-1)
        mu = newmu
        A301276_list.append(variance.denominator) # Chai Wah Wu, Mar 22 2018