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-10 of 17 results. Next

A006562 Balanced primes (of order one): primes which are the average of the previous prime and the following prime.

Original entry on oeis.org

5, 53, 157, 173, 211, 257, 263, 373, 563, 593, 607, 653, 733, 947, 977, 1103, 1123, 1187, 1223, 1367, 1511, 1747, 1753, 1907, 2287, 2417, 2677, 2903, 2963, 3307, 3313, 3637, 3733, 4013, 4409, 4457, 4597, 4657, 4691, 4993, 5107, 5113, 5303, 5387, 5393
Offset: 1

Views

Author

Keywords

Comments

Subsequence of A075540. - Franklin T. Adams-Watters, Jan 11 2006
This subsequence of A125830 and of A162174 gives primes of level (1,1): More generally, the i-th prime p(i) is of level (1,k) if and only if it has level 1 in A117563 and 2 p(i) - p(i+1) = p(i-k). - Rémi Eismann, Feb 15 2007
Note the similarity between plots of A006562 and A013916. - Bill McEachen, Sep 07 2009
Balanced primes U strong primes = good primes. Or, A006562 U A051634 = A046869. - Juri-Stepan Gerasimov, Mar 01 2010
Primes prime(n) such that A001223(n-1) = A001223(n). - Irina Gerasimova, Jul 11 2013
Numbers m such that A346399(m) is odd and >= 3. - Ya-Ping Lu, Dec 26 2021 and May 07 2024
"Balanced" means that the next and preceding gap are of the same size, i.e., the second difference A036263 vanishes; so these are the primes whose indices are 1 more than indices of zeros in A036263, listed in A064113. - M. F. Hasler, Oct 15 2024
Primes which are the average of three consecutive primes. - Peter Schorn, Apr 30 2025

Examples

			5 belongs to the sequence because 5 = (3 + 7)/2. Likewise 53 = (47 + 59)/2.
5 belongs to the sequence because it is a term, but not first or last, of the AP of consecutive primes (3, 5, 7).
53 belongs to the sequence because it is a term, but not first or last, of the AP of consecutive primes (47, 53, 59).
257 and 263 belong to the sequence because they are terms, but not first or last, of the AP of consecutive primes (251, 257, 263, 269).
		

References

  • A. Murthy, Smarandache Notions Journal, Vol. 11 N. 1-2-3 Spring 2000.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers (Rev. ed. 1997), p. 134.

Crossrefs

Primes A000040 whose indices are 1 more than A064113, indices of zeros in A036263 (second differences of the primes).
Cf. A225494 (multiplicative closure); complement of A178943 with respect to A000040.
Cf. A055380, A051795, A081415, A096710 for other balanced prime sequences.

Programs

  • Haskell
    a006562 n = a006562_list !! (n-1)
    a006562_list = filter ((== 1) . a010051) a075540_list
    -- Reinhard Zumkeller, Jan 20 2012
    
  • Haskell
    a006562 n = a006562_list !! (n-1)
    a006562_list = h a000040_list where
       h (p:qs@(q:r:ps)) = if 2 * q == (p + r) then q : h qs else h qs
    -- Reinhard Zumkeller, May 09 2013
    
  • Magma
    [a: n in [1..1000] | IsPrime(a) where a is NthPrime(n)-NthPrime(n+1)+NthPrime(n+2)]; // Vincenzo Librandi, Jun 23 2016
    
  • Mathematica
    Transpose[ Select[ Partition[ Prime[ Range[1000]], 3, 1], #[[2]] ==(#[[1]] + #[[3]])/2 &]][[2]]
    p=Prime[Range[1000]]; p[[Flatten[1+Position[Differences[p, 2], 0]]]]
    Prime[#]&/@SequencePosition[Differences[Prime[Range[800]]],{x_,x_}][[All,2]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 31 2019 *)
  • PARI
    betwixtpr(n) = { local(c1,c2,x,y); for(x=2,n, c1=c2=0; for(y=prime(x-1)+1,prime(x)-1, if(!isprime(y),c1++); ); for(y=prime(x)+1,prime(x+1)-1, if(!isprime(y),c2++); ); if(c1==c2,print1(prime(x)",")) ) } \\ Cino Hilliard, Jan 25 2005
    
  • PARI
    forprime(p=1,999, p-precprime(n-1)==nextprime(p+1)-p && print1(p",")) \\ M. F. Hasler, Jun 01 2013
    
  • PARI
    is(n)=n-precprime(n-1)==nextprime(n+1)-n && isprime(n) \\ Charles R Greathouse IV, Apr 07 2016
    
  • Python
    from sympy import nextprime; p, q, r = 2, 3, 5
    while q < 6000:
        if 2*q == p + r: print(q, end = ", ")
        p, q, r = q, r, nextprime(r) # Ya-Ping Lu, Dec 23 2021

Formula

2*p_n = p_(n-1) + p_(n+1).
Equals { p = prime(k) | A118534(k) = prime(k-1) }. - Rémi Eismann, Nov 30 2009
a(n) = A000040(A064113(n) + 1) = (A122535(n) + A181424(n)) / 2. - Reinhard Zumkeller, Jan 20 2012
a(n) = A122535(n) + A117217(n). - Zak Seidov, Feb 14 2013
Equals A145025 intersect A000040 = A145025 \ A024675. - M. F. Hasler, Jun 01 2013
Conjecture: Limit_{n->oo} n*(log(a(n)))^2 / a(n) = 1/2. - Alain Rocchelli, Mar 21 2024
Conjecture: The asymptotic limit of the average of a(n+1)-a(n) is equivalent to 2*(log(a(n)))^2. Otherwise formulated: 2 * Sum_{n=1..N} (log(a(n)))^2 ~ a(N). - Alain Rocchelli, Mar 23 2024

Extensions

Reworded comment and added formula from R. Eismann. - M. F. Hasler, Nov 30 2009
Edited by Daniel Forgues, Jan 15 2011

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

A096701 Balanced primes of order nine.

Original entry on oeis.org

983, 2351, 4019, 4093, 4957, 8731, 10009, 10211, 10271, 11549, 11593, 12809, 13831, 17971, 21647, 25633, 30313, 32411, 33911, 34283, 37277, 37511, 38711, 39749, 41617, 41737, 42299, 46643, 48809, 49121, 49451, 51599, 53381, 54541, 54559
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2004

Keywords

Examples

			983 is a member because 983 = (919 + 929 + 937 + 941 + 947 + 953 + 967 + 971 + 977 + 983 + 991 + 997 + 1009 + 1013 + 1019 + 1021 + 1031 + 1033 + 1039)/19 = 18677/19.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..80000],IsPrime);;
    a:=List(Filtered(List([0..6000],k->List([10..28],j->P[j-9+k])),i->
    Sum(i)/19=i[10]),m->m[10]); # Muniru A Asiru, Feb 14 2018
    
  • Mathematica
    Transpose[ Select[ Partition[ Prime[ Range[7500]], 19, 1], #[[10]] == (#[[1]] + #[[2]] + #[[3]] + #[[4]] + #[[5]] + #[[6]] + #[[7]] + #[[8]] + #[[9]] + #[[11]] + #[[12]] + #[[13]] + #[[14]] + #[[15]] + #[[16]] + #[[17]] + #[[18]] + #[[19]])/18 &]][[10]]
    #[[10]] & /@ Select[Partition[Prime[Range[7500]], 19, 1], #[[10]] == Mean[#] &] (* Zak Seidov, Mar 01 2017 *)
  • PARI
    isok(p) = {if (isprime(p), k = primepi(p); if (k > 9, sum(i=k-9, k+9, prime(i)) == 19*p;););} \\ Michel Marcus, Mar 07 2018

A096697 Balanced primes of order five.

Original entry on oeis.org

53, 89, 157, 421, 433, 823, 991, 1297, 1709, 1873, 2347, 2411, 2441, 2729, 2797, 3617, 4793, 5059, 5417, 6343, 6781, 7583, 7933, 8581, 8861, 9029, 9857, 11213, 11953, 12329, 13229, 14081, 14411, 15767, 15889, 16561, 16889, 17029, 20297, 22469
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2004

Keywords

Examples

			53 is a member because 53 = (31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71 + 73)/11. 53 is also an order one balance prime (A006562) and an order three balanced prime (A082078), thus it has an balanced index of three (A096707).
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..70000],IsPrime);;
    a:=List(Filtered(List([0..3000],k->List([6..16],j->P[j-5+k])),i->
    Sum(i)/11=i[6]),m->m[6]); # Muniru A Asiru, Feb 14 2018
    
  • Mathematica
    Transpose[ Select[ Partition[ Prime[ Range[5000]], 11, 1], #[[6]] == (#[[1]] + #[[2]] + #[[3]] + #[[4]] + #[[5]] + #[[7]] + #[[8]] + #[[9]] + #[[10]] + #[[11]])/10 &]][[6]]
    (* Second program: *)
    With[{k = 5}, 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 *)
  • PARI
    isok(p) = {if (isprime(p), k = primepi(p); if (k > 5, sum(i=k-5, k+5, prime(i)) == 11*p;););} \\ Michel Marcus, Mar 07 2018

A096698 Balanced primes of order six.

Original entry on oeis.org

71, 211, 397, 409, 1487, 1559, 2281, 4397, 4937, 5347, 5857, 7577, 10399, 11369, 12583, 14843, 19391, 21739, 21787, 22067, 22469, 23789, 25639, 27329, 29537, 29867, 30197, 30911, 33347, 33931, 34267, 35099, 36131, 36691, 37549, 38671
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2004

Keywords

Examples

			71 is a member because 71 = (43 + 47 + 53 + 59 + 61 + 67 + 71 + 73 + 79 + 83 + 89 + 97 + 101)/13.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..90000],IsPrime);;
    b:=6;;
    a:=List(Filtered(List([0..5000],k->List([b+1..3*b+1],j->P[j-b+k])),i->Sum(i)/(2*b+1)=i[b+1]),m->m[b+1]); # Muniru A Asiru, Feb 15 2018
    
  • Mathematica
    Transpose[ Select[ Partition[ Prime[ Range[5000]], 13, 1], #[[7]] == (#[[1]] + #[[2]] + #[[3]] + #[[4]] + #[[5]] + #[[6]] + #[[8]] + #[[9]] + #[[10]] + #[[11]] + #[[12]] + #[[13]])/12 &]][[7]]
    Transpose[Select[Partition[Prime[Range[5000]],13,1],Total[#]/13==#[[7]]&]][[7]]  (* Harvey P. Dale, Feb 25 2011 *)
  • PARI
    isok(p) = {if (isprime(p), k = primepi(p); if (k >6, sum(i=k-6, k+6, prime(i)) == 13*p;););} \\ Michel Marcus, Mar 07 2018

A096699 Balanced primes of order seven.

Original entry on oeis.org

29, 977, 1381, 1439, 3109, 3539, 4357, 4397, 5563, 7159, 8273, 8737, 10711, 11117, 13109, 13841, 15101, 18731, 18839, 20543, 21391, 21851, 23459, 24877, 27653, 28477, 28697, 30677, 32029, 32971, 34631, 35863, 36979, 37019, 37529, 38189
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2004

Keywords

Examples

			29 is a member because 29 = (5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59)/15.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..70000],IsPrime);;
    a:=List(Filtered(List([0..5000],k->List([8..22],j->P[j-7+k])),i->
    Sum(i)/15=i[8]),m->m[8]); # Muniru A Asiru, Feb 14 2018
    
  • Mathematica
    Transpose[ Select[ Partition[ Prime[ Range[5000]], 15, 1], #[[8]] == (#[[1]] + #[[2]] + #[[3]] + #[[4]] + #[[5]] + #[[6]] + #[[7]] + #[[9]] + #[[10]] + #[[11]] + #[[12]] + #[[13]] + #[[14]] + #[[15]])/14 &]][[8]]
    (* Second program: *)
    With[{k = 7}, Select[MapIndexed[{Prime[First@ #2 + k], #1} &, Mean /@ Partition[Prime@ Range[5000], 2 k + 1, 1]], SameQ @@ # &][[All, 1]]] (* Michael De Vlieger, Feb 15 2018 *)
  • PARI
    isok(p) = {if (isprime(p), k = primepi(p); if (k > 7, sum(i=k-7, k+7, prime(i)) == 15*p;););} \\ Michel Marcus, Mar 07 2018

A096700 Balanced primes of order eight.

Original entry on oeis.org

37, 151, 173, 487, 1153, 2621, 4357, 4451, 5189, 5209, 5431, 6131, 7499, 8429, 8641, 9323, 10093, 10321, 10883, 10949, 11117, 11213, 11369, 11821, 12583, 16001, 16741, 18169, 18289, 22067, 23761, 25747, 29989, 33589, 36691, 39671, 39749, 39779
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2004

Keywords

Examples

			37 is a member because 37 = (7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71)/17.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..50000],IsPrime);;
    a:=List(Filtered(List([0..5000],k->List([1..17],j->P[j+k])),i->Sum(i)/17=i[9]),m->m[9]); # Muniru A Asiru, Mar 03 2018
  • Mathematica
    Select[Partition[Prime[Range[5000]],17,1],Mean[#]==#[[9]]&][[;;,9]] (* Harvey P. Dale, Jul 06 2023 *)

Extensions

Incorrect previous Mathematica program deleted by Harvey P. Dale, Jul 06 2023

A096702 Balanced primes of order ten.

Original entry on oeis.org

5503, 6301, 8233, 14489, 14591, 14747, 15907, 17789, 20543, 22067, 22699, 23321, 24593, 25423, 26251, 26347, 28477, 29059, 33161, 41023, 42337, 44021, 48187, 51551, 53279, 55001, 59693, 64661, 78173, 81457, 82561, 84017, 85621, 88301
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2004

Keywords

Examples

			5503 is a member because
5503 = (5431 + 5437 + 5441 + 5443 + 5449 + 5471 + 5477 + 5479 + 5483 + 5501 + 5503 + 5507 + 5519 + 5521 + 5527 + 5531 + 5557 + 5563 + 5569 + 5573 + 5581)/21 = 115563/21.
		

Crossrefs

Programs

  • Mathematica
    Transpose[ Select[ Partition[ Prime[ Range[10000]], 21, 1], #[[11]] == (#[[1]] + #[[2]] + #[[3]] + #[[4]] + #[[5]] + #[[6]] + #[[7]] + #[[8]] + #[[9]] + #[[10]] + #[[12]] + #[[13]] + #[[14]] + #[[15]] + #[[16]] + #[[17]] + #[[18]] + #[[19]] + #[[20]] + #[[21]])/20 &]][[11]]
    Transpose[Select[Partition[Prime[Range[9000]],21,1],Total[#]/21 == #[[11]]&]][[11]] (* Harvey P. Dale, Mar 09 2014 *)

A096703 Balanced primes of order eleven.

Original entry on oeis.org

173, 353, 631, 827, 3329, 4723, 13693, 17789, 20947, 21059, 21503, 23563, 23599, 27751, 29759, 35419, 36781, 37991, 44939, 52021, 57163, 57269, 57719, 59663, 68713, 70529, 70879, 71399, 75541, 76949, 78301, 79621, 94399, 101929, 104759
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2004

Keywords

Examples

			173 is a member because 173 = (109 + 113 + 127 + 131 + 137 + 139 + 149 + 151 + 157 + 163 + 167 + 173 + 179 + 181 + 191 + 193 + 197 + 199 + 211 + 223 + 227 + 229 + 233)/23 = 3979/23.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..150000],IsPrime);;
    a:=List(Filtered(List([0..12000],k->List([1..23],j->P[j+k])),i->Sum(i)/23=i[12]),m->m[12]); # Muniru A Asiru, Mar 04 2018
  • Mathematica
    Transpose[ Select[ Partition[ Prime[ Range[10000]], 23, 1], #[[12]] == (#[[1]] + #[[2]] + #[[3]] + #[[4]] + #[[5]] + #[[6]] + #[[7]] + #[[8]] + #[[9]] + #[[10]] + #[[11]] + #[[13]] + #[[14]] + #[[15]] + #[[16]] + #[[17]] + #[[18]] + #[[19]] + #[[20]] + #[[21]] + #[[22]] + #[[23]])/22 &]][[12]]
    Transpose[Select[Partition[Prime[Range[11000]],23,1],Mean[#] == #[[12]]&]][[12]] (* Harvey P. Dale, Nov 06 2011 *)
Showing 1-10 of 17 results. Next