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

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

A055380 Central prime p in the smallest (2n+1)-tuple of consecutive primes that are symmetric with respect to p.

Original entry on oeis.org

5, 18731, 683783, 98303927, 60335249959, 1169769749219, 3945769040699039, 159067808851610657, 6919940122097246597
Offset: 1

Views

Author

Jud McCranie, Jun 23 2000

Keywords

Comments

Least n-tuply balanced primes: primes which are averages of both their immediate neighbors, their second neighbors, their third neighbors, ... and their n-th neighbors.
a(9) <= 6919940122097246597. The solution was found by the BOINC project "SPT test project". - Natalia Makarova, Nov 25 2023
a(n) is the smallest number m such that A346399(m) = 2n + 1. - Ya-Ping Lu, May 12 2024

Examples

			In 5-tuple of consecutive primes (18713, 18719, 18731, 18743, 18749), the primes are symmetric w.r.t. its central prime 18731, since 18713+18749 = 18719+18743 = 2*18731, and this is the smallest such 5-tuple. Hence, a(2)=18731.
Alternatively, the symmetry can be seen from the differences between consecutive primes. For (18713, 18719, 18731, 18743, 18749), the differences are (6,12,12,6).
		

Crossrefs

Programs

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

Formula

a(n) = A151800^(n)(A175309(2n)), i.e., A151800 applied n times on A175309(2n). - Max Alekseyev, Jul 26 2014

Extensions

a(6) from Donovan Johnson, Mar 09 2008
Definition corrected by Max Alekseyev, Jul 29 2014
a(7) from Dmitry Petukhov, added by Max Alekseyev, Nov 03 2014
a(8) from SPT project, added by Dmitry Petukhov, Apr 06 2017
a(9) from SPT project, added by Dmitry Petukhov, Mar 25 2025

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

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

A347986 Length of identical sequence of prime / nonprime numbers left and right of the integer n (excluded).

Original entry on oeis.org

0, 0, 0, 1, 2, 2, 1, 0, 5, 0, 1, 8, 1, 0, 9, 0, 1, 6, 1, 0, 3, 0, 3, 0, 1, 4, 1, 0, 1, 18, 1, 0, 1, 4, 1, 0, 3, 0, 3, 0, 1, 12, 1, 0, 3, 0, 3, 0, 1, 6, 1, 0, 7, 0, 1, 4, 1, 0, 1, 10, 1, 0, 1, 4, 1, 0, 3, 0, 3, 0, 1, 4, 1, 0, 1, 4, 1, 0, 3, 0, 9, 0, 3, 0, 1, 6, 1, 0, 5, 0, 1, 2, 7, 2, 1, 0, 3, 0, 3
Offset: 1

Views

Author

Lothar Esser, Sep 22 2021

Keywords

Examples

			For n=2 (first useful term) the result is 0 because 2 is preceded by 1 which is by definition nonprime and succeeded by 3 which is prime meaning symmetry is broken right away. A better example may be 5 with a value of 2. The two numbers preceding 5 are 3, 4: prime, nonprime and the succeeding values are 6 and 7 being nonprime and prime. In other words, starting from 5 as center, the first positions are 4 (left) and 6 (right), both nonprimes. The next positions are 3 and 7, both primes. The sequence is now 2 long. It breaks after that because 2 is prime but 8 is nonprime. So we note 2 or 5. Very interesting is 30 which has a sequence of 18 on each side that follow the same pattern.
From _Jon E. Schoenfield_, Sep 22 2021: (Start)
As shown in the illustration below, where P and N denote prime and nonprime, respectively, the distribution of primes and nonprimes around n=21 is symmetrical in the interval [18, 24] = [21-3, 21+3], but not in the interval [17, 25] = [21-4, 21+4] (since 17 is prime but 25 is composite), so a(21) = 3:
.
              |<------- 3 -------->|<------- 3 -------->|
      17     18     19     20     21     22     23     24     25
  -----+------+------+------+------+------+------+------+------+-----
       P      N      P      N      N      N      P      N      N
              |      |      |             |      |      |
              |      |      +-------------+      |      |
              |      +---------------------------+      |
              +-----------------------------------------+
(End)
		

Crossrefs

Cf. A343730, A346399 (number of primes in the interval n +- a(n)).

Programs

  • Mathematica
    Table[s={n-1,n+1};k=0;While[SameQ@@PrimeQ@s,k++;s=s+{-1,+1}];k,{n,2,85}] (* Giorgos Kalogeropoulos, Sep 23 2021 *)
  • PARI
    f(n) = {my (nb = 0, fL, fR); fL = n\2; if (n%2, fR = fL+1, fL--; fR = fL+2); for (i=0, oo, if (isprime(fL-i) != isprime(fR+i), break, nb++);); if (n%2, 2*nb, 2*nb+1);} \\ A343730
    a(n) = (f(2*n) - 1)/2; \\ Michel Marcus, Sep 24 2021
  • Python
    from sympy import *
    seq_pole = []
    seq_pole.append(-1) #0
    seq_pole.append(-1) #1
    for i in range(1, 1000):
        d = 1
        #  Check how far the left is identical to the
        # (mirrored) right
        while isprime(i-d) == isprime(i+d):
            d = d + 1
        dmax = d - 1
        seq_pole.append(dmax)
        # i is the center (index) and dmax is the max extent
        # on each side that is the same (or mirrored at i if you will)
        print("{}".format(dmax))
    

Formula

From Jon E. Schoenfield, Sep 22 2021: (Start)
a(n) = Max_{k : A010051(n-j) = A010051(n+j) for 0 <= j <= k}.
a(n) = (A343730(2*n) - 1)/2. (End)

Extensions

More terms from Michel Marcus, Sep 24 2021

A348176 Numbers m such that the number of symmetrically distributed consecutive primes centered at m sets a new record.

Original entry on oeis.org

1, 2, 4, 5, 9, 12, 30, 165, 8021811, 1071065190, 1613902650, 1797595815015, 633925574060895
Offset: 1

Views

Author

Ya-Ping Lu, Oct 05 2021

Keywords

Comments

Conjecture: This sequence is infinite.

Examples

			n    a(n) = m   A346399(m)  Symmetrical consecutive primes centered at m
--  ----------  ----------  --------------------------------------------
1            1       0                           { }
2            2       1                           {2}
3            4       2                          {3,5}
4            5       3                         {3,5,7}
5            9       4                        {5,7,11,13}
6           12       6                     {5,7,11,13,17,19}
7           30      10             {13,17,19,23,29,31,37,41,43,47}
8          165      12                {m +- 2,8,14,16,26,28}
9      8021811      14              {m +- 10,20,22,40,52,58,62}
10  1071065190      16              {m +- 11,23,37,49,53,61,67,79}
11  1613902650      18             {m +- 1,7,23,29,49,77,83,89,97}
		

Crossrefs

Cf. A346399.

Programs

  • Python
    from sympy import isprime
    rec = -1
    for n in range(1, 10**10):
        d = 1 if n%2 == 0 else 2
        ct = 1 if isprime(n) else 0
        while n - d > 2:
            k = isprime(n+d) + isprime(n-d)
            if k == 2: ct += 2
            elif k == 1: break
            d += 2
        if ct > rec: print(n, end = ', '); rec = ct

Extensions

a(12)-a(13) from Martin Ehrenstein, Nov 21 2021

A367848 Lengths >= 2 of symmetrical subsequences within the prime gaps sequence.

Original entry on oeis.org

2, 3, 5, 5, 3, 9, 5, 2, 3, 3, 3, 5, 3, 3, 5, 2, 11, 2, 3, 3, 2, 3, 2, 3, 2, 3, 5, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 2, 5, 2, 2, 3, 7, 3, 2, 3, 3, 5, 5, 7, 3, 3, 5, 2, 2, 3, 5, 3, 3, 3, 2, 5, 2, 3, 2, 2, 3, 7, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 5
Offset: 1

Views

Author

Tamas Sandor Nagy, Dec 02 2023

Keywords

Comments

Points in the primes gap sequence (A001223) are taken successively at a term and halfway between terms.
The lengths here are of subsequences made of 2 or more symmetrically placed, consecutive prime gaps around such a point.
Some points only have a subsequence of length 0 or 1 around them and they are ignored.
Will all odd numbers appear in this sequence?
Do the terms have a long-term average?

Examples

			The first lengths are as follows, around midpoints marked with ".",
  Gaps:  1   2   2   4   2   4   2    = A001223
             \_._/                  length 2 = a(1)
                 \___.___/          length 3 = a(2)
                 \_______._______/  length 5 = a(3)
		

Crossrefs

Programs

  • PARI
    diff(v) = vector(#v-1, i, v[i+1]-v[i]);
    issym(v) = if (#v>1, for (j=1, #v\2, if (v[j] != v[#v-j+1], return(0))); return(1));
    lista(nn) = my(v = diff(primes(nn))); for (len=2, #v, for (i=0, len\2, my(w = vector(len-2*i, j, v[i+j])); if (issym(w), print1(#w, ", "); break););); \\ Michel Marcus, Dec 05 2023
Showing 1-7 of 7 results.