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 23 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

A051795 Doubly balanced primes: primes which are averages of both their immediate and their second neighbors.

Original entry on oeis.org

18731, 25621, 28069, 30059, 31051, 44741, 76913, 97441, 103669, 106681, 118831, 128449, 135089, 182549, 202999, 240491, 245771, 249199, 267569, 295387, 347329, 372751, 381401, 435751, 451337, 455419, 471521, 478099, 498301, 516877, 526441, 575231, 577873
Offset: 1

Views

Author

Harvey P. Dale, Dec 10 1999

Keywords

Comments

Could also be called overbalanced or [3,5]-balanced primes: balanced primes which are equally average of 3,5 consecutive prime neighbors as follows: a(n)=[q+a(n)+r]/3=[p+q+a(n)+r+s]/5 See 3-balanced=A006562;[3,5,7]-balanced=A081415. - Labos Elemer, Apr 02 2003
Numbers m such that A346399(m) is odd and >= 5. - Ya-Ping Lu, May 11 2024

Examples

			25621 belongs to the sequence because 25621 = (25609 + 25633)/2 = (25603 + 25609 + 25633 + 25639)/4.
		

Crossrefs

Programs

  • Mathematica
    Transpose[Select[Partition[Prime[Range[50000]],5,1],(#[[1]]+#[[5]])/2 == (#[[2]]+#[[4]])/2 == #[[3]]&]][[3]] (* Harvey P. Dale, Sep 13 2013 *)
  • Python
    from sympy import nextprime; p, q, r, s, t = 2, 3, 5, 7, 11
    while t < 580000:
        if p + t == q + s == 2*r: print(r, end = ', ')
        p, q, r, s, t = q, r, s, t, nextprime(t) # Ya-Ping Lu, May 11 2024

A055382 Smallest prime starting a sequence of 2n consecutive odd primes with symmetrical gaps about the center.

Original entry on oeis.org

3, 5, 5, 17, 13, 137, 8021749, 1071065111, 1613902553, 1797595814863, 633925574060671, 22930603692243271, 5179852391836338871, 9648166508472058129
Offset: 1

Views

Author

Jud McCranie, Jun 23 2000

Keywords

Comments

a(13) <= 5179852391836338871. The solution was found by the BOINC project "SPT test project". - Natalia Makarova, Dec 06 2023

Examples

			The first term is 3 since the 2 primes 3, 5 have a gap of 2, which is trivially symmetric about its center.
The second term is 5 since the 4 primes 5, 7, 11, 13 have gaps 2, 4, 2, which is symmetric about its center.
The twelve primes 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193 have gaps 2, 10, 2, 6, 6, 4, 6, 6, 2, 10, 2 - symmetric about the middle, so a(6) = 137.
		

Crossrefs

See A081235 for another version.

Programs

  • Mathematica
    Table[i = 1;
     While[x = Differences[Table[Prime[k + i], {k, 2 n}]];
    x != Reverse[x], i++]; Prime[i + 1], {n, 6}] (* Robert Price, Oct 12 2019 *)

Formula

For n>1, a(n) = A081235(n) = A175309(2n-1).

Extensions

a(10) from Donovan Johnson, Mar 09 2008
Minor edits by N. J. A. Sloane, Apr 02 2010
a(11) from Dmitry Petukhov, added by Max Alekseyev, Aug 08 2014
a(12) from an anonymous participant of the project, added by Max Alekseyev, Jul 21 2015
a(13)-a(14) from SPT test project, added by Dmitry Petukhov, Mar 16 2025

A055381 Smallest composite k such that the n closest primes below and above k are symmetric about k.

Original entry on oeis.org

4, 9, 12, 30, 30, 165, 8021811, 1071065190, 1613902650, 1797595815015, 633925574060895, 22930603692243585, 5179852391836339140, 9648166508472058455
Offset: 1

Views

Author

Jud McCranie, Jun 23 2000

Keywords

Comments

Center of the smallest 2n-tuple of consecutive odd primes with symmetrical gaps (cf. A055382).

Examples

			The three primes on each side of 12 (13, 17, 19 and 11, 7, 5) are symmetrical with respect to the gaps, so a(3) = 12.
		

Crossrefs

Programs

  • Mathematica
    Table[i = n + 2;
     While[x =
       Differences@
        Flatten@{Table[NextPrime[i, k], {k, -n, -1}], i,
          Table[NextPrime[i, k], {k, 1, n}]}; x != Reverse[x],
    i++]; i, {n, 6}] (* Robert Price, Oct 12 2019 *)

Formula

a(n) = ( A055382(n) + A000040(A000720(A055382(n))+2n) ) / 2 = ( A055382(n) + A151800(...(A151800(A055382(n)))...) ) / 2, where A151800 is iterated 2n times. - Max Alekseyev, Jul 23 2015
a(n) = (A000040(m) + A000040(m+1))/2, where m = min( {k >= 2 : A359440(k) >= n-1} ). - Peter Munn, Jan 09 2023

Extensions

a(10) from Donovan Johnson, Mar 09 2008
a(11) from Dmitry Petukhov, added by Max Alekseyev, Aug 08 2014
a(12) computed from A055382(12) by Max Alekseyev, Jul 23 2015
Name clarified by Peter Munn, Jan 09 2023
a(13)-a(14) computed from A055382 by Dmitry Petukhov, Mar 25 2025

A081235 Smallest prime starting a sequence of 2n consecutive primes with symmetrical gaps about the center.

Original entry on oeis.org

2, 5, 5, 17, 13, 137, 8021749, 1071065111, 1613902553, 1797595814863, 633925574060671, 22930603692243271, 5179852391836338871, 9648166508472058129
Offset: 1

Views

Author

Keywords

Examples

			The first term is 2 since the 2 primes 2, 3 have a gap of 1, which is trivially symmetric about its center.
The second term is 5 since the 4 primes 5, 7, 11, 13 have gaps 2, 4, 2, which is symmetric about its center.
The twelve primes 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193 have gaps 2, 10, 2, 6, 6, 4, 6, 6, 2, 10, 2 - symmetric about the middle, so a(6) = 137.
		

Crossrefs

Programs

  • PARI
    A081235(n) = { my(last=vector(n*=2,i,prime(i)), m, i=Mod(n-2,n)); forprime(p=last[n],default(primelimit), m=last[1+lift(i+2)]+last[1+lift(i++)]=p; for(j=1,n\2,last[1+lift(i-j)]+last[1+lift(i+j+1)]==m||next(2)); return(last[1+lift(i+1)]))} \\ M. F. Hasler, Apr 02 2010

Formula

a(n) = A175309(2n-1) (= A055382(n) for n>1). [M. F. Hasler, Apr 02 2010]
a(n) = A000040(k), where k = least number such that A359440(k+n-1) >= n-1. - Peter Munn, Jan 05 2023

Extensions

a(11) from Dmitry Petukhov, added by Max Alekseyev, Aug 08 2014
a(12) from an anonymous participant of the project, added by Natalia Makarova, Jul 16 2015
a(13)-a(14) from SPT test project, added by Dmitry Petukhov, Mar 16 2025

A122117 a(n) = 3*a(n-1) + 4*a(n-2), with a(0)=1, a(1)=2.

Original entry on oeis.org

1, 2, 10, 38, 154, 614, 2458, 9830, 39322, 157286, 629146, 2516582, 10066330, 40265318, 161061274, 644245094, 2576980378, 10307921510, 41231686042, 164926744166, 659706976666, 2638827906662, 10555311626650, 42221246506598
Offset: 0

Views

Author

Philippe Deléham, Oct 19 2006

Keywords

Comments

Inverse binomial transform of A005053. Binomial transform of [1, 1, 7, 13, 55, ...] = A015441(n+1).
Convolved with [1, 2, 2, 2, ...] = powers of 4: [1, 4, 16, 64, ...]. - Gary W. Adamson, Jun 02 2009
a(n) is the number of compositions of n when there are 2 types of 1 and 6 types of other natural numbers. - Milan Janjic, Aug 13 2010

Crossrefs

Programs

  • GAP
    a:=[1,2];; for n in [3..30] do a[n]:=3*a[n-1]+4*a[n-2]; od; a; # G. C. Greubel, May 18 2019
    
  • Magma
    I:=[1, 2]; [n le 2 select I[n] else 3*Self(n-1)+4*Self(n-2): n in [1..30]]; // Vincenzo Librandi, Jul 06 2012
    
  • Mathematica
    CoefficientList[Series[(1-x)/(1-3*x-4*x^2),{x,0,30}],x] (* Vincenzo Librandi, Jul 06 2012 *)
  • PARI
    Vec((1-x)/(1-3*x-4*x^2)+O(x^30)) \\ Charles R Greathouse IV, Jan 11 2012
    
  • Python
    def A122117(n): return ((4<<(m:=n<<1))|2)//5-((1<Chai Wah Wu, Apr 22 2025
  • Sage
    from sage.combinat.sloane_functions import recur_gen2b; it = recur_gen2b(1,2,3,4, lambda n: 0); [next(it) for i in range(24)] # Zerinvary Lajos, Jul 03 2008
    
  • Sage
    ((1-x)/(1-3*x-4*x^2)).series(x, 30).coefficients(x, sparse=False) # G. C. Greubel, May 18 2019
    

Formula

a(n) = 2*A108981(n-1) for n > 0, with a(0) = 1.
a(2*n) = 4*a(2*n-1) + 2, a(2*n+1) = 4*a(2*n) - 2.
a(n) = Sum_{k=0..n} 2^(n-k)*A055380(n,k).
G.f.: (1-x)/(1-3*x-4*x^2).
Lim_{n->infinity} a(n+1)/a(n) = 4.
a(n) = Sum_{k=0..n} A122016(n,k)*2^k. - Philippe Deléham, Nov 05 2008
a(n) = A100088(2*n). - Chai Wah Wu, Apr 22 2025

Extensions

Corrected by T. D. Noe, Nov 07 2006

A266512 Smallest prime starting a (nonsingular) symmetric n-tuplet of the shortest span (=A266511(n)).

Original entry on oeis.org

2, 3, 47, 5, 18713, 7, 12003179, 17, 1480028129, 13, 1542186111157, 41280160361347, 660287401247633, 10421030292115097, 3112462738414697093, 996689250471604163, 258406392900394343851, 824871967574850703732309, 9425346484752129657862217, 824871967574850703732303
Offset: 1

Views

Author

Max Alekseyev, Dec 30 2015

Keywords

Comments

A similar sequence that allows singular symmetric n-tuples is given in A266583.
a(1)-a(10) from Natalia Makarova
a(11)-a(14), a(16) from Dmitry Petukhov
a(15), a(17) from Jaroslaw Wroblewski

Crossrefs

Formula

a(n) = A000040(A266584(n)).

Extensions

a(18) from Jaroslaw Wroblewski
a(20) from Natalia Makarova and Jaroslaw Wroblewski
a(19) from Dmitry Petukhov, Anton Nikonov and Ruslan Vikulov, Jan 24 2025

A081415 Triply balanced primes: primes which are averages of both their immediate neighbor, their second neighbors and their third neighbors.

Original entry on oeis.org

683783, 1056317, 1100261, 2241709, 2815301, 4746359, 10009049, 12003209, 13810981, 14907649, 15403009, 15730067, 16595081, 17518201, 19755301, 20378327, 21006487, 21574453, 21579983, 22237121, 22625179, 25876901, 26018791, 26354201, 27188141, 28469461
Offset: 1

Views

Author

Labos Elemer, Apr 02 2003

Keywords

Comments

Equivalently, primes which are balanced primes of orders 1, 2, and 3. - Muniru A Asiru, Apr 08 2018
Numbers m such that A346399(m) is odd and >= 7. - Ya-Ping Lu, May 11 2024

Examples

			p = 683383: 683747 + ... + p + ... + 683819 = 7p; 683759 + ... + p + ... + 683807 = 5p; 683777 + p + 683789 = 3p.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1,3..3*10^7+1],IsPrime);;
    a:=Intersection(List([1,2,3],b->List(Filtered(List([0..Length(P)-(2*b+1)],k->List([1..2*b+1],j->P[j+k])),i->Sum(i)/(2*b+1)=i[b+1]),m->m[b+1]))); # Muniru A Asiru, Apr 08 2018
    
  • Mathematica
    a = {}; Do[p = 2Prime[n]; If[p == Prime[n - 1] + Prime[n + 1] && p == Prime[n - 2] + Prime[n + 2] && p == Prime[n - 3] + Prime[n + 3], Print[p / 2]; AppendTo[a, p / 2]], {n, 5, 1100000}]; a (* Robert G. Wilson v, Jun 28 2004 *)
    Transpose[Select[Partition[Prime[Range[1620000]],7,1],(#[[1]]+#[[7]])/2 == (#[[2]]+#[[6]])/2==(#[[3]]+#[[5]])/2==#[[4]]&]][[4]] (* Harvey P. Dale, Sep 13 2013 *)
  • Python
    from sympy import nextprime; p, q, r, s, t, u, v = 2, 3, 5, 7, 11, 13, 17
    while v < 29000000:
        if p + v == q + u == r + t == 2*s: print(s, end = ', ')
        p, q, r, s, t, u, v = q, r, s, t, u, v, nextprime(v) # Ya-Ping Lu, May 11 2024

A082080 Smallest balanced prime of order n.

Original entry on oeis.org

2, 5, 79, 17, 491, 53, 71, 29, 37, 983, 5503, 173, 157, 353, 5297, 263, 179, 383, 137, 2939, 2083, 751, 353, 5501, 1523, 149, 4561, 1259, 397, 787, 8803, 8803, 607, 227, 3671, 17443, 57097, 3607, 23671, 12539, 1217, 11087, 1087, 21407, 19759, 953
Offset: 0

Views

Author

Labos Elemer, Apr 08 2003

Keywords

Comments

Or, smallest (2n+1)-balanced prime number.
Prime(k) is a balanced prime of order n if it is the average of the 2n+1 primes from prime(k-n) to prime(k+n).

Examples

			a(1) = 5 = (3 + 5 + 7)/3 = 15/3.
a(5) = 53 = (31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71 + 73)/11 = 583/11.
a(6) = 71 = (43 + 47 + 53 + 59 + 61 + 67 + 71 + 73 + 79 + 83 + 89 + 97 + 101)/13 = 923/13.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = Prime@ Range[2n +1]}, While[ Total[p] != (2n +1) p[[n +1]], p = Join[Rest@ p, {NextPrime[ p[[-1]]] }]]; p[[n +1]]]; Array[f, 46, 0] (* Robert G. Wilson v, Jun 21 2004 and modified Apr 11 2017 *)
  • PARI
    for(n=0, 50, 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", ");f=1;break)); if(!f, print1("0, ")))

Extensions

Corrected and extended by Ralf Stephan, Apr 09 2003

A096710 Quadruply balanced primes: primes which are averages of their immediate neighbor primes, their second neighbor primes, their third neighbor primes and their fourth neighbor primes.

Original entry on oeis.org

98303927, 580868459, 784857323, 857636141, 909894647, 951508837, 1367470823, 1480028171, 1850590099, 2106973159, 2121382079, 2409718043, 2635873907, 2704854637, 3225527099, 3386231579, 3823510039, 3824915671, 3905211517, 4123167667, 4127991383, 4386448117
Offset: 1

Views

Author

Robert G. Wilson v, Jun 28 2004

Keywords

Examples

			98303927 is a member because 98303927 = (98303903 + 98303951)/2 = (98303897 + 98303957)/2 = (98303873 + 98303981)/2 = (98303867 + 98303987)/2.
		

Crossrefs

Programs

  • Mathematica
    a = {}; Do[p = 2Prime[n]; If[p == Prime[n - 1] + Prime[n + 1], If[ p == Prime[n - 2] + Prime[n + 2], If[p == Prime[n - 3] + Prime[n + 3], If[p == Prime[n - 4] + Prime[n + 4], Print[p/2]; AppendTo[a, p/2]]]]], {n, 6, 117039731}]; a
    Select[Partition[Prime[Range[207405000]],9,1],(#[[1]]+#[[9]])/2 == (#[[2]]+ #[[8]])/2 == (#[[3]]+#[[7]])/2==(#[[4]]+#[[6]])/2==#[[5]]&][[All,5]] (* Harvey P. Dale, Dec 27 2018 *)

Extensions

More terms from Jud McCranie, Sep 29 2006
Showing 1-10 of 23 results. Next