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-8 of 8 results.

A096266 Balanced prime number records (A082080).

Original entry on oeis.org

2, 5, 79, 491, 983, 5503, 8803, 17443, 57097, 155219, 343583, 500179, 524521, 1208239, 1457969, 2076331, 2906291, 2977151, 3129031, 4893341, 8442079, 8560787, 11156987, 11596003, 14947939, 17922829, 20545477, 24597173, 25593493, 34395139, 34466101, 43047541, 51074711, 58531043
Offset: 1

Views

Author

Robert G. Wilson v, Jun 21 2004

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{k = n + 2, s = Plus @@ Table[ Prime[i], {i, 2, 2n + 2}]}, While[s != (2n + 1)Prime[k], k++; s = s - Prime[k - n - 1] + Prime[k + n]]; Prime[k]]; p = 1; Do[ q = f[n]; If[q > p, Print[n, " = ", q]; p = q], {n, 1230}]

Extensions

More terms, using A082080, from Michel Marcus, Jul 12 2023

A082312 Half the difference between start and center prime of the smallest [2n+1]-balanced prime set (A082080).

Original entry on oeis.org

1, 4, 5, 14, 11, 14, 12, 15, 32, 36, 32, 30, 41, 65, 42, 41, 53, 45, 75, 76, 69, 63, 99, 98, 60, 112, 99, 84, 94, 130, 132, 103, 87, 140, 172, 175, 144, 190, 171, 140, 200, 145, 203, 190, 155, 168, 202, 210, 144, 157, 254, 185, 189, 306, 201, 323, 303, 229, 267
Offset: 1

Views

Author

Ralf Stephan, Apr 09 2003

Keywords

Examples

			The smallest 5-balanced prime, 79 (center of 71,73,79,83,89) minus 8 is 71, so a(2)=8/2=4.
		

Crossrefs

Programs

  • PARI
    for(n=1, 80, i=2*n+1; f=0; forprime(p=2, 10^7, s=0; c=i; pr=p-1; t=0; while(c>0, c=c-1; pr=nextprime(pr+1); s=s+pr; if(c==(i-1)/2, t=pr)); if(s/i==t, print1((t-p)/2", "); f=1; break)); if(!f, print1("0, ")))

A096692 "Orders" where balanced prime number records (A082080) occur.

Original entry on oeis.org

0, 1, 2, 4, 9, 10, 30, 35, 36, 56, 86, 109, 158, 195, 213, 287, 331, 373, 409, 432, 462, 579, 638, 656, 722, 749, 894, 1154, 1177, 1225, 1304, 1414, 1416, 1550, 1800, 1844, 2091, 2114, 2351, 2851, 4218, 4344, 4658, 5054, 5627, 5836, 7092, 7997, 8204, 8324, 8889, 9527
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2004

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{k = n + 2, s = Plus @@ Table[ Prime[i], {i, 2, 2n + 2}]}, While[s != (2n + 1)Prime[k], k++; s = s - Prime[k - n - 1] + Prime[k + n]]; Prime[k]]; p = 1; Do[ q = f[n]; If[q > p, Print[n, " = ", q]; p = q], {n, 1230}]

Formula

a(n) = A082080(A096266(n)).

Extensions

a(31)-a(52) from Robert Price, Dec 02 2023

A082077 Balanced primes of order two.

Original entry on oeis.org

79, 281, 349, 439, 643, 677, 787, 1171, 1733, 1811, 2141, 2347, 2389, 2767, 2791, 3323, 3329, 3529, 3929, 4157, 4349, 4751, 4799, 4919, 4951, 5003, 5189, 5323, 5347, 5521, 5857, 5861, 6287, 6337, 6473, 6967, 6997, 7507, 7933, 8233, 8377, 8429, 9377, 9623, 9629, 10093, 10333
Offset: 1

Views

Author

Labos Elemer, Apr 08 2003

Keywords

Comments

The arithmetic mean of 4 primes in its "neighborhood"; not to be confused with 'Doubly balanced primes' (A051795).
Balanced primes of order two are not necessarily balanced of order one (A006562) or three (A082078).
Subsequence of A219478, Peter Schorn, May 01 2025

Examples

			p = 79 = (71 + 73 + 79 + 83 + 89)/5 = 395/5 i.e. it is both the arithmetic mean and median.
		

Crossrefs

Programs

  • Mathematica
    Do[s3=Prime[n]+Prime[n+1]+Prime[n+2]; s5=Prime[n-1]+s3+Prime[n+3]; If[Equal[s5/5, Prime[n+1]], Print[Prime[n+1]]], {n, 3, 3000}]
    Select[Partition[Prime[Range[1500]],5,1],Mean[#]==#[[3]]&][[All,3]] (* Harvey P. Dale, Nov 04 2019 *)
  • PARI
    p=2;q=3;r=5;s=7;forprime(t=11,1e9,if(p+q+s+t==4*r,print1(r", ")); p=q; q=r; r=s; s=t) \\ Charles R Greathouse IV, Nov 20 2012

A082079 Balanced primes of order four.

Original entry on oeis.org

491, 757, 1787, 3571, 6337, 6451, 6991, 7741, 7907, 8821, 10141, 10267, 10657, 12911, 15299, 16189, 18223, 18701, 19801, 19843, 19853, 19937, 21961, 22543, 22739, 22807, 23893, 23909, 24767, 25169, 25391, 26591, 26641, 26693, 26713
Offset: 1

Views

Author

Labos Elemer, Apr 08 2003

Keywords

Comments

The arithmetic mean of 8 primes in its "neighborhood"; not to be confused with 'Quadruply balanced primes' (A096710).
A balanced prime of order four is not necessarily balanced (A006562) order one, or of order two (A082077), or of order three (A082078), etc.

Examples

			p = 491 = (463 + 467 + 479 + 487 + 491 + 499 + 503 + 509 + 521)/9 = 4419/9.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..50000],IsPrime);;
    a:=List(Filtered(List([0..3000],k->List([5..13],j->P[j-4+k])), i-> Sum(i)/9=i[5]),m->m[5]); # Muniru A Asiru, Feb 14 2018
    
  • Mathematica
    Do[s3=Prime[n]+Prime[n+1]+Prime[n+2]; s5=Prime[n-1]+s3+Prime[n+3]; s7=Prime[n-2]+s5+Prime[n+4]; s9=Prime[n-3]+s7+Prime[n+5]; If[Equal[s9/9, Prime[n+1]], Print[Prime[n+1]]], {n, 4, 10000}]
    (* Second program: *)
    With[{k = 4}, Select[MapIndexed[{Prime[First@ #2 + k], #1} &, Mean /@ Partition[Prime@ Range[3000], 2 k + 1, 1]], SameQ @@ # &][[All, 1]]] (* Michael De Vlieger, Feb 15 2018 *)
    Select[Partition[Prime[Range[3000]],9,1],Mean[#]==#[[5]]&][[;;,5]] (* Harvey P. Dale, Mar 09 2023 *)
  • PARI
    isok(p) = {if (isprime(p), k = primepi(p); if (k > 4, sum(i=k-4, k+4, prime(i)) == 9*p;););} \\ Michel Marcus, Mar 07 2018

A082078 Balanced primes of order three.

Original entry on oeis.org

17, 53, 157, 173, 193, 229, 349, 439, 607, 659, 701, 709, 977, 1153, 1187, 1301, 1619, 2281, 2287, 2293, 2671, 2819, 2843, 3067, 3313, 3539, 3673, 3727, 3833, 4013, 4051, 4517, 4951, 5101, 5897, 6079, 6203, 6211, 6323, 6679, 6869, 7321, 7589, 7643, 7907
Offset: 1

Views

Author

Labos Elemer, Apr 08 2003

Keywords

Comments

The arithmetic mean of 6 primes in its "neighborhood"; not to be confused with 'Triply balanced primes' (A081415).
A balanced prime of order three is not necessarily balanced of order one (A006562) or two (A082077), etc. [Typo corrected by Zak Seidov, Jul 23 2008]

Examples

			p = 53 = (41 + 43 + 47 + 53 + 59 + 61 + 67)/7 = 371/7 i.e. it is the arithmetic mean.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..10000],IsPrime);;
    a:=List(Filtered(List([0..1000],k->List([4..10],j->P[j-3+k])), i->
    Sum(i)/7=i[4]),m->m[4]); # Muniru A Asiru, Feb 14 2018
    
  • Mathematica
    Do[s3=Prime[n]+Prime[n+1]+Prime[n+2]; s5=Prime[n-1]+s3+Prime[n+3]; s7=Prime[n-2]+s5+Prime[n+4]; If[Equal[s7/7, Prime[n+1]], Print[Prime[n+1]]], {n, 3, 5000}]
    (* Second program: *)
    With[{k = 3}, Select[MapIndexed[{Prime[First@ #2 + k], #1} &, Mean /@ Partition[Prime@ Range[10^3], 2 k + 1, 1]], SameQ @@ # &][[All, 1]]]  (* Michael De Vlieger, Feb 15 2018 *)
    Select[Partition[Prime[Range[1500]],7,1],Mean[#]==#[[4]]&][[All,4]] (* Harvey P. Dale, Jul 01 2022 *)
  • PARI
    isok(p) = {if (isprime(p), k = primepi(p); if (k > 3, sum(i=k-3, k+3, prime(i)) == 7*p;););} \\ Michel Marcus, Mar 07 2018

A364163 Least number k such that average of {prime(i) | k - n <= i <= k + n} is prime(k), or -1 if no such number exists.

Original entry on oeis.org

1, 3, 22, 7, 94, 16, 20, 10, 12, 166, 727, 40, 37, 71, 702, 56, 41, 76, 33, 424, 314, 133, 71, 726, 241, 35, 618, 205, 78, 138, 1096, 1096, 111, 49, 512, 2006, 5790, 504, 2634, 1497, 199, 1344, 181, 2404, 2237, 162, 241, 470, 667, 81, 106, 2940, 209, 209, 5549
Offset: 0

Views

Author

Jean-Marc Rebert, Jul 12 2023

Keywords

Examples

			a(0) = 1, because 2/1 = 2 = prime(1), and no lesser number satisfies this.
a(1) = 3, because (3+5+7)/3 = 5 = prime(3), and no lesser number satisfies this.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{ps = Prime[Range[2*n+1]], k = n+1}, While[Total[ps] != (2*n+1)* ps[[n+1]], ps = Join[Rest[ps], {NextPrime[ps[[-1]]]}]; k++]; k]; Array[a, 55, 0] (* Amiram Eldar, Sep 07 2024 *)
  • PARI
    a(n) = my(k=n+1); while(sum(i=k-n, k+n, prime(i)) != (2*n+1)*prime(k), k++); k; \\ Michel Marcus, Jul 12 2023

Formula

a(n) = A000720(A082080(n)). - Michel Marcus, Jul 12 2023

A374576 a(n) is the smallest prime prime(k) such that prime(k-n) and prime(k+n) are balanced primes of order n.

Original entry on oeis.org

7829, 18713, 211, 19891, 2381, 63649, 183971, 11287, 67957, 2197697, 345749, 1359913, 2267827, 543383, 16705691, 2667311, 3369869, 38094029, 35605289, 3303059, 26184253, 44116757, 4271017, 35099179, 44191919, 296115661, 86828801, 169863823, 991, 163355419, 10301623, 115044443, 240284293
Offset: 1

Views

Author

Robert Israel, Jul 11 2024

Keywords

Comments

a(n) is the least prime that is the start and end of sequences of 2*n+1 consecutive primes whose arithmetic means are their medians.

Examples

			a(3) = 211 because the 7 consecutive primes 179, 181, 191, 193, 197, 199, 211 ending at 211 have mean = median = 193 and the 7 consecutive primes 211, 223, 227, 229, 233, 239, 241 starting at 211 have mean = median = 229, and 211 is the first prime for which this works.
		

Crossrefs

Programs

  • Maple
    f:= proc(n)
     local S,i;
     S:= [seq](ithprime(i),i=1..4*n+1);
     do
       if convert(S[1..2*n+1],`+`) = (2*n+1)*S[n+1] and convert(S[2*n+1..4*n+1],`+`) = (2*n+1)*S[3*n+1] then
       return S[2*n+1] fi;
       S:= [op(S[2..-1]),nextprime(S[-1])]
     od;
    end proc:
    map(f, [$1..35]);
  • PARI
    alist(N) = {my(r=vector(N), p=primes(4*N+1), t); while(t=Vec(select(x->!x, r, 1)), foreach(t, n, my(w=2*n+1); if(vecsum(p[1..w])==w*p[1+n] && vecsum(p[w..2*w-1])==w*p[w+n], r[n]=p[w])); p=primes([p[2], nextprime(p[#p]+1)])); r;} \\ Ruud H.G. van Tol, Jul 13 2024
Showing 1-8 of 8 results.