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.

Showing 1-6 of 6 results.

A273462 Rounded variance of the first n primes, for n > 1.

Original entry on oeis.org

0, 2, 5, 13, 19, 31, 41, 56, 81, 103, 136, 171, 201, 235, 280, 335, 384, 444, 505, 560, 626, 693, 772, 869, 966, 1055, 1145, 1229, 1314, 1447, 1578, 1719, 1849, 2008, 2156, 2313, 2479, 2644, 2818, 3000, 3171, 3372, 3560, 3748, 3925, 4142, 4398, 4651, 4890
Offset: 2

Views

Author

Andres Cicuttin, May 23 2016

Keywords

Crossrefs

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

Programs

  • Mathematica
    Table[Round[Variance[Prime[Range[j]]]], {j, 2, 50}]
  • Sage
    round(variance(primes_first_n(n))) # Danny Rorabaugh, May 25 2016

Formula

a(n) = round(Sum_{i=1..n} (prime(i) - Sum_{j=1..n} prime(j)/n)^2/(n - 1)), n > 1.

A301273 Numerator of mean of first n primes.

Original entry on oeis.org

2, 5, 10, 17, 28, 41, 58, 77, 100, 129, 160, 197, 238, 281, 328, 381, 440, 167, 568, 639, 712, 791, 38, 321, 212, 1161, 1264, 1371, 1480, 531, 1720, 1851, 1988, 2127, 2276, 809, 2584, 2747, 2914, 3087, 3266, 1149, 3638, 3831, 4028, 4227, 4438, 4661
Offset: 1

Views

Author

N. J. A. Sloane, Mar 18 2018

Keywords

Examples

			The means are 2, 5/2, 10/3, 17/4, 28/5, 41/6, 58/7, 77/8, 100/9, 129/10, 160/11, 197/12, 238/13, 281/14, 328/15, 381/16, 440/17, 167/6, 568/19, 639/20, 712/21, 791/22, 38, 321/8, 212/5, ...
		

Crossrefs

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

Programs

  • Maple
    m := n -> add(ithprime(j),j=1..n)/n;
    m1:=[seq(m(n),n=1..100)];
    m2:=map(numer,m1); # A301273
    m3:=map(denom,m1); # A301274
    m4:=map(round,m1); # A301277
  • Mathematica
    a[n_] := Prime @ Range[n] // Mean // Numerator;
    a /@ Range[100] (* Jean-François Alcover, Nov 16 2019 *)
  • Python
    from fractions import Fraction
    from sympy import prime
    A301273_list, mu = [], Fraction(0)
    for i in range(1,10001):
        mu += (prime(i)-mu)/i
        A301273_list.append(mu.numerator) # Chai Wah Wu, Mar 22 2018

A301275 Numerator of variance of first n primes.

Original entry on oeis.org

0, 1, 7, 59, 64, 581, 649, 2287, 1001, 2443, 5669, 17915, 6665, 36637, 3529, 22413, 22813, 13065, 75865, 191819, 58778, 289013, 7627, 141973, 5213, 628001, 370333, 96211, 249436, 381167, 672727, 1565639, 453767, 691587, 1194917, 301867, 770294
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, 0, Variance[Prime[Range[n]]] // Numerator];
    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)
    A301275_list = [variance.numerator]
    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
        A301275_list.append(variance.numerator) # Chai Wah Wu, Mar 22 2018

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

A301277 Nearest integer to mean of first n primes.

Original entry on oeis.org

2, 3, 3, 4, 6, 7, 8, 10, 11, 13, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 45, 47, 49, 51, 53, 55, 58, 60, 63, 65, 67, 70, 72, 75, 77, 80, 82, 85, 87, 90, 92, 94, 97, 100, 102, 105, 107, 110, 113, 115, 118, 121, 123, 126, 128, 131, 133
Offset: 1

Views

Author

N. J. A. Sloane, Mar 18 2018

Keywords

Comments

Differs from A075465 where ties are involved. - R. J. Mathar, Mar 20 2018

Examples

			The means are 2, 5/2, 10/3, 17/4, 28/5, 41/6, 58/7, 77/8, 100/9, 129/10, 160/11, 197/12, 238/13, 281/14, 328/15, 381/16, 440/17, 167/6, 568/19, 639/20, 712/21, 791/22, 38, 321/8, 212/5, ...
		

Crossrefs

Programs

  • Maple
    m := n -> add(ithprime(j),j=1..n)/n;
    m1:=[seq(m(n),n=1..100)];
    m2:=map(numer,m1); # A301273
    m3:=map(denom,m1); # A301274
    m4:=map(round,m1); # A301277
  • Mathematica
    Rest@ FoldList[{Append[First@ #1, #2], If[And[EvenQ@ #1, #2 == 1/2] & @@ {IntegerPart@ #, FractionalPart@ #}, Round@ # + 1, Round@ #] &@ Mean@ First@ #1} &, {{2}, 2}, Prime@ Range[2, 63]][[All, -1]] (* Michael De Vlieger, Apr 05 2018 *)
  • PARI
    a(n) = round(sum(i=1, n, prime(i))/n); \\ Altug Alkan, Mar 22 2018

Formula

a(n) = round(A007504(n) / n). - David A. Corneth, Mar 22 2018
a(n) ~ prime(n)/2 ~ n*log(n)/2. - Daniel Forgues, Mar 22 2018

A361627 Positive integers such that GCD(A007504(n),n) != 1.

Original entry on oeis.org

18, 23, 24, 25, 30, 36, 42, 53, 54, 56, 57, 63, 78, 84, 85, 90, 99, 105, 111, 117, 123, 126, 129, 138, 154, 170, 177, 180, 190, 195, 207, 213, 222, 228, 230, 237, 238, 240, 245, 246, 252, 258, 270, 273, 275, 276, 282, 288, 297, 299, 303, 304, 309, 318, 319, 322, 327, 333, 339, 345
Offset: 1

Views

Author

Luca Onnis, Mar 18 2023

Keywords

Comments

A301274(k) != k implies that k is a term of this sequence.
Conjecture: a(n) ~ C*n as n -> infinity, where 5.25 < C < 5.35.

Examples

			18 is a term of this sequence since the sum of the first 18 primes is 501 and GCD(501,18) = 3 != 1.
		

Crossrefs

Programs

  • Mathematica
    s[n_] := Sum[Prime[k], {k, 1, n}];
    Complement[Table[n, {n, 1, 1000}], Flatten[Position[Table[GCD[s[n], n], {n, 1, 1000}], 1]]]
  • PARI
    isok(k) = gcd(vecsum(primes(k)), k) != 1; \\ Michel Marcus, Mar 18 2023
    
  • Python
    from math import gcd
    from itertools import count, islice
    from sympy import nextprime
    def A361627_gen(): # generator of terms
        p, s = 2, 2
        for n in count(1):
            if gcd(n,s) > 1:
                yield n
            s += (p:=nextprime(p))
    A361627_list = list(islice(A361627_gen(),20)) # Chai Wah Wu, Mar 22 2023
Showing 1-6 of 6 results.