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

A099655 a[n]=A098085[n]-A096215[n], difference between next and previous primes to A011974[n], the sum of two consecutive primes.

Original entry on oeis.org

4, 4, 2, 2, 6, 2, 6, 2, 6, 2, 4, 6, 6, 8, 4, 4, 14, 4, 2, 10, 6, 6, 6, 10, 2, 12, 12, 12, 12, 2, 6, 6, 6, 10, 14, 4, 14, 14, 10, 4, 8, 6, 6, 8, 8, 10, 6, 8, 8, 2, 12, 8, 8, 6, 12, 18, 18, 10, 6, 6, 6, 2, 2, 12, 12, 6, 12, 8, 10, 8, 10, 8, 4, 6, 8, 4, 14, 12, 2, 2, 14, 14, 14, 14, 2, 20, 20, 8, 10, 8
Offset: 1

Views

Author

Labos Elemer, Nov 17 2004

Keywords

Examples

			n=8, p(8)+p(9)=19+23=42,a[8]=43-41=2=a(8).
		

Crossrefs

Programs

  • Mathematica
    <Harvey P. Dale, Mar 07 2017 *)

Formula

a(n)=NextPrime[p(n)+p(n+1)]-PreviousPrime[p(n)+p(n+1)]

A098084 a(n) satisfies P(n) + P(n+1) + a(n) = least prime >= P(n) + P(n+1), where P(i)=i-th prime.

Original entry on oeis.org

0, 3, 1, 1, 5, 1, 1, 1, 1, 1, 3, 1, 5, 7, 1, 1, 7, 3, 1, 5, 5, 1, 1, 5, 1, 7, 1, 7, 1, 1, 5, 1, 1, 5, 7, 3, 11, 1, 7, 1, 7, 1, 5, 7, 1, 9, 5, 7, 1, 1, 7, 7, 7, 1, 1, 9, 1, 9, 5, 5, 1, 1, 1, 7, 1, 5, 5, 7, 5, 7, 7, 1, 3, 5, 7, 1, 1, 11, 1, 1, 13, 1, 13, 5, 1, 15, 1, 1, 5, 7, 1, 1, 5, 1, 7, 1, 1, 5, 5, 3, 5, 3, 19
Offset: 1

Views

Author

Pierre CAMI, Sep 13 2004

Keywords

Comments

a(n) = 1 iff prime(n) is in A177017. - Robert Israel, Feb 04 2020

Examples

			P(1) + P(2) = 2 + 3 = 5; least prime >= 5 = 5, so a(1)=0.
P(2) + P(3) = 3 + 5 = 8; least prime > 8 = 11, so a(2) = 11 - 8 = 3.
P(3) + P(4) = 5 + 7 = 12; least prime > 12 = 13, so a(3) = 13 - 12 = 1.
		

Crossrefs

The primes are in A098085.
Cf. A177017.

Programs

  • Maple
    P:= [seq(ithprime(i),i=1..200)]:
    map(t -> nextprime(t-1)-t,P[1..-2]+P[2..-1]); # Robert Israel, Feb 04 2020
  • Mathematica
    f[n_] := Block[{k = 0, p = Prime[n] + Prime[n + 1]}, While[ !PrimeQ[p + k], k++ ]; k]; Table[ f[n], {n, 103}] (* Robert G. Wilson v, Sep 24 2004 *)

Extensions

More terms from Robert G. Wilson v, Sep 25 2004

A366274 a(n) is the least k such that prime(n+1+k) >= prime(n)+prime(n+1).

Original entry on oeis.org

1, 2, 2, 3, 4, 4, 4, 5, 6, 7, 8, 9, 10, 10, 10, 13, 13, 13, 14, 14, 15, 15, 16, 18, 20, 20, 19, 19, 18, 22, 24, 24, 25, 27, 27, 27, 29, 28, 29, 30, 31, 31, 33, 33, 32, 34, 37, 39, 38, 39, 40, 40, 41, 42, 42, 43, 42, 43, 43, 43
Offset: 1

Views

Author

Patrick Butler, Oct 05 2023

Keywords

Comments

a(n) is the number of primes between prime(n) and prime(n) + prime(n+1).
Conjecture: for n >= 3, a(n) < n.

Examples

			For n = 5 prime(n) = 11. prime(5) + prime(6) = 11+13=24.  The 4th prime after 13 is 29 which is the next prime after 13 greater than or equal to 24. So a(5) = 4.
		

Crossrefs

Programs

  • Maple
    R:= 1: pn:= 2: pn1:= 3: p:=5: m:= 4: pp:= 7:
    for n from 2 to 100 do
      pn:= pn1; pn1:= nextprime(pn1);
      while pp <= pn + pn1 do m:= m+1; pp:= nextprime(pp); od;
      R:= R, m-n-1;
    od:
    R; # Robert Israel, Oct 31 2023
  • Mathematica
    A366274[n_]:=PrimePi[Prime[n]+Prime[n+1]-1]-n;Array[A366274,100] (* Paolo Xausa, Dec 09 2023 *)
  • PARI
    a(n) = my(k=1, q=prime(n)+prime(n+1)); while(prime(n+k) < q, k++); k; \\ Michel Marcus, Oct 06 2023
  • Python
    m=0
    #list here is a list of prime numbers A000040.
    def a(n):
        global list
        sum= list[n]+list[n+1]
        i=n+2
        while True:
            if(list[i]>=sum):
                m=i
                break
            i=i+1
        k = m-(n+1)
        return k
    #
    #calculate the terms of the sequence a(n).
    seq = []
    for n in range(0,firstN):
       seq.append(a(n))
    

Formula

a(n) = A000720(A001043(n)-1)-n = A000720(A076273(n+1))-n. - Paolo Xausa, Dec 09 2023
Showing 1-3 of 3 results.