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.

A145026 Fibonacci numbers in A145025.

Original entry on oeis.org

5, 21, 34, 144, 610, 987, 24157817, 7540113804746346429, 18547707689471986212190138521399707760, 382699285659014174244530850035136059033084785
Offset: 1

Views

Author

Keywords

Programs

  • Mathematica
    PrimeNextDelta[n_]:=(Do[If[PrimeQ[n+k],d=k;Break[]],{k,12!}];d)(*Deltabetweenprimeandnextconsecutiveprime.*) PrimePrevDelta[n_]:=(Do[If[PrimeQ[n-k],d=k;Break[]],{k,12!}];d)(*Deltabetweenprimeandprevconsecutiveprime.*) lst={};Do[f=Fibonacci[n];d1=PrimePrevDelta[f];d2=PrimeNextDelta[f];If[d1==d2,AppendTo[lst,f]],{n,3,3*5!}];lst

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

A024675 Average of two consecutive odd primes.

Original entry on oeis.org

4, 6, 9, 12, 15, 18, 21, 26, 30, 34, 39, 42, 45, 50, 56, 60, 64, 69, 72, 76, 81, 86, 93, 99, 102, 105, 108, 111, 120, 129, 134, 138, 144, 150, 154, 160, 165, 170, 176, 180, 186, 192, 195, 198, 205, 217, 225, 228, 231, 236, 240, 246, 254, 260, 266, 270, 274, 279, 282, 288, 300
Offset: 1

Views

Author

Keywords

Comments

Sometimes called interprimes.
Where local maxima of A072681 occur: A072681(a(n))=A074927(n+1). - Reinhard Zumkeller, Mar 04 2009
Never prime, for that would contradict the definition. - Jon Perry, Dec 05 2012
A subset of A145025, obtained from that sequence by omitting the primes (which are barycenter of their neighboring primes). - M. F. Hasler, Jun 01 2013
Conjecture: Product_{k=1..n} a(k)/A028334(k+1) is an integer for every natural n. Cf. A352743. - Thomas Ordowski, Mar 31 2022
In contrast to the arithmetic mean, the geometric and the harmonic mean of two consecutive primes is never an integer. What is the first case where either of the two would differ from the arithmetic mean, i.e., this sequence? The existence of such a pair of primes is related to Legendre's conjecture, cf. link to discussion on the math-fun mailing list. - M. F. Hasler, Apr 07 2025

Crossrefs

Cf. A072568, A072569. Bisections give A058296, A079424.
Cf. A373699 (partial sums).

Programs

  • Maple
    seq( ( (ithprime(x)+ithprime(x+1))/2 ),x=2..40);
  • Mathematica
    Plus @@@ Partition[Table[Prime[n], {n, 2, 100}], 2, 1]/2
    ListConvolve[{1, 1}/2, Prime /@ Range[2, 70]] (* Jean-François Alcover, Jun 25 2013 *)
    Mean/@Partition[Prime[Range[2,70]],2,1] (* Harvey P. Dale, Jul 28 2020 *)
  • PARI
    for(X=2,50,print((prime(X)+prime(X+1))/2)) \\ Hauke Worpel (thebigh(AT)outgun.com), May 08 2008
    
  • PARI
    first(n)=my(v=primes(n+2)); vector(n,i,v[i+1]+v[i+2])/2 \\ Charles R Greathouse IV, Jun 25 2013
    
  • Python
    from sympy import prime
    def a(n): return (prime(n + 1) + prime(n + 2)) // 2
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jul 11 2017

Formula

a(n) = (prime(n+1)+prime(n+2))/2 = A001043(n+1)/2. - Omar E. Pol, Feb 02 2012
Conjecture: a(n) = ceiling(sqrt(prime(n+1)*prime(n+2))). - Thomas Ordowski, Mar 22 2013 [This requires gaps to be smaller than approximately sqrt(8p) and hence requires a result on prime gaps slightly stronger than that provided by the Riemann hypothesis. - Charles R Greathouse IV, Jul 13 2022]
Equals A145025 \ A006562 = A145025 \ A000040. - M. F. Hasler, Jun 01 2013

A264719 Numbers that are greater than the average of their closest flanking primes.

Original entry on oeis.org

10, 11, 16, 17, 22, 27, 28, 29, 35, 36, 37, 40, 41, 46, 51, 52, 57, 58, 59, 65, 66, 67, 70, 71, 77, 78, 79, 82, 87, 88, 94, 95, 96, 97, 100, 101, 106, 107, 112, 121, 122, 123, 124, 125, 126, 127, 130, 135, 136, 137, 145, 146, 147, 148, 149, 155, 156, 161, 162
Offset: 1

Views

Author

Chris Boyd, Nov 21 2015

Keywords

Comments

Numbers that are nearer to the immediately next prime than to the immediately previous prime.
This sequence may be viewed as a generalization of A051634 (the strong primes) that includes qualifying composite numbers.
The union of this sequence with A264720 & A145025 is A000027 (omitting 1 & 2).

Examples

			a(11) = 37 because 37 > (31 + 41)/2 = 36.
a(12) = 40 because 40 > (37 + 41)/2 = 37.
		

Crossrefs

Programs

  • Mathematica
    Select[Range@ 162, # > (Abs@ NextPrime[#, -1] + NextPrime@ #)/2 &] (* Michael De Vlieger, Nov 22 2015 *)
  • PARI
    test(n)= {if(n-precprime(n-1)>nextprime(n+1)-n&&n>2,return(1),return(0))}
    for(i=1,200,if(test(i),print1(i,", ")))

A264720 Numbers that are less than the average of their closest flanking primes.

Original entry on oeis.org

3, 7, 8, 13, 14, 19, 20, 23, 24, 25, 31, 32, 33, 38, 43, 44, 47, 48, 49, 54, 55, 61, 62, 63, 68, 73, 74, 75, 80, 83, 84, 85, 89, 90, 91, 92, 98, 103, 104, 109, 110, 113, 114, 115, 116, 117, 118, 119, 128, 131, 132, 133, 139, 140, 141, 142, 143, 151, 152, 153, 158
Offset: 1

Views

Author

Chris Boyd, Nov 21 2015

Keywords

Comments

Numbers that are nearer to the immediately previous prime than to the immediately next prime.
This sequence may be viewed as a generalization of A051635 (the weak primes) that includes qualifying composite numbers.
The union of this sequence with A264719 & A145025 is A000027 (omitting 1 & 2).

Examples

			a(11) = 31 because 31 < (29 + 37)/2 = 33.
a(12) = 32 because 32 < (31 + 37)/2 = 34.
		

Crossrefs

Programs

  • Mathematica
    Select[Range@ 162, # < (NextPrime[#, -1] + NextPrime@ #)/2 &] (* Michael De Vlieger, Nov 22 2015 *)
  • PARI
    test(n)= {if(n-precprime(n-1)2,return(1),return(0))}
    for(i=1,200,if(test(i),print1(i,", ")))

A226178 Exponents n such that 2^n - previous_prime(2^n) = next_prime(2^n) - 2^n.

Original entry on oeis.org

2, 6, 12, 76, 181, 1099, 1820, 9229
Offset: 1

Views

Author

Jean-François Alcover, May 30 2013

Keywords

Comments

The differences next_prime(2^n) - 2^n are respectively: 1, 3, 3, 15, 165, 1035, 663, 2211.
If it exists, a(9) > 10000. - Hugo Pfoertner, Feb 06 2021

Examples

			2^6 = 64, next prime = 67, previous prime = 61, 67-64 = 64-61 = 3, hence 6 is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    Reap[Do[m = 2^n; p = NextPrime[m, -1]; q = NextPrime[m]; If[p + q == 2*m, Print[n]; Sow[n]], {n, 2, 10^4}]][[2, 1]]
  • PARI
    isok(n) = my(p=2^n); p-precprime(p-1) == nextprime(p+1) - p; \\ Michel Marcus, Oct 02 2019
    
  • PARI
    for(n=2,1100,my(p2=2^n,pn=nextprime(p2),pp=p2-pn+p2);if(ispseudoprime(pp),if(precprime(p2)==pp,print1(n,", ")))) \\ Hugo Pfoertner, Feb 06 2021
    
  • Python
    from itertools import count, islice
    from sympy import isprime, nextprime
    def A226178_gen(): # generator of terms
        return filter(lambda n:isprime(r:=((k:=1<A226178_list = list(islice(A226178_gen(),5)) # Chai Wah Wu, Aug 08 2022

Formula

A340707(a(n)) = 0. - Hugo Pfoertner, Feb 06 2021

Extensions

Offset 1 from Michel Marcus, Oct 02 2019
a(8) from Hugo Pfoertner, Feb 05 2021

A165298 Numbers k with property that 14*k is a sum of two consecutive primes.

Original entry on oeis.org

3, 6, 8, 15, 22, 31, 33, 38, 45, 57, 60, 63, 66, 69, 76, 80, 82, 102, 123, 126, 132, 140, 141, 142, 148, 150, 154, 156, 158, 159, 160, 168, 170, 171, 183, 186, 192, 204, 207, 208, 213, 215, 225, 232, 245, 246, 250, 255, 258, 261, 267, 272, 276, 285, 294, 303
Offset: 1

Views

Author

Zak Seidov, Sep 14 2009

Keywords

Comments

Minimal difference d=p2-p1 is 2 while d may be arbitrarily large.
For n<10^7 largest d is for n=2435971: 14*n=34103594, p1=17051707, p2=17051887, d=p2-p1=180.
Numbers k such that 7*k is in A145025. - Robert Israel, Jun 17 2019

Examples

			3*14=42=19+23,d=4; 6*14=84=41+43,d=2; 8*14=112=53+59,d=6.
		

Crossrefs

Cf. A145025.

Programs

  • Maple
    filter:= proc(n) local t;
      nextprime(7*n)+prevprime(7*n)=14*n;
    end proc:
    select(filter, [$1..1000]); # Robert Israel, Jun 17 2019

A333839 a(n) = Sum_{k = 4..n} ((prevprime(k) + nextprime(k))/2 - k).

Original entry on oeis.org

0, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 2, 4, 5, 5, 4, 2, 0, 0, 2, 4, 5, 5, 4, 2, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 2, 4, 5, 5, 4, 2, 2, 4, 5, 5, 4, 2, 0, 0, 2, 4, 5, 5, 4, 2, 1, 2, 2, 1, 0, 0, 2, 4, 5, 5, 4, 2, 1, 2, 2, 1, 2, 4, 5, 5, 4, 2, 3, 6, 8, 9, 9, 8, 6
Offset: 4

Views

Author

Ctibor O. Zizka, Apr 07 2020

Keywords

Comments

It looks like a(n) >= 0 for all n >= 4.
If (n,n+2) are twin primes, then a(n) = 0 and a(n+1) = 0.
Partial sums of b(k) = prevprime(k) + nextprime(k) - 2*k; b(k) = 0 for A145025.

Examples

			a(4) = (3 + 5)/2 - 4 = 0;
a(5) = (3 + 5)/2 - 4 + (3 + 7)/2 - 5 = 0.
		

Crossrefs

Programs

  • Mathematica
    Array[Sum[Total[NextPrime[k, {-1, 1}]]/2 - k, {k, 4, #}] &, 92, 4] (* Michael De Vlieger, Apr 10 2020 *)

Formula

a(n) = Sum_{k = 4..n} (A013632(k) - A049711(k)) / 2.
Showing 1-8 of 8 results.