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

A090405 a(n) = PrimePi(n+2) - PrimePi(n).

Original entry on oeis.org

2, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1
Offset: 1

Views

Author

Eric W. Weisstein, Nov 29 2003

Keywords

Comments

For n>1, a(n) = 1 if n+1 or n+2 is prime, otherwise a(n) = 0. - Robert Israel, Mar 30 2017

Crossrefs

Programs

  • Maple
    with(numtheory): A090405:=n->pi(n+2)-pi(n): seq(A090405(n), n=1..150); # Wesley Ivan Hurt, Mar 30 2017
  • Mathematica
    Table[Subtract @@ Map[PrimePi, n + {2, 0}], {n, 120}] (* or *)
    Table[Boole@ PrimeQ[n + 1 + Boole[OddQ@ n]] + Boole[n == 1], {n, 120}] (* Michael De Vlieger, Mar 30 2017 *)
  • PARI
    for(n=1, 100, print1(primepi(n + 2) - primepi(n),", ")) \\ Indranil Ghosh, Mar 31 2017
    
  • Python
    from sympy import primepi
    print([primepi(n + 2) - primepi(n) for n in range(1, 101)])
    # Indranil Ghosh, Mar 31 2017
    
  • Python
    from sympy import isprime
    def a(n):
        if n<2: return 2
        else:
            if isprime(n + 1 + (n%2 == 1) + (n==1)): return 1
            else: return 0 # Indranil Ghosh, Mar 31 2017

A168141 a(n) = pi(n + 1) - pi(n - 2), where pi is the prime counting function.

Original entry on oeis.org

1, 2, 2, 2, 1, 2, 1, 1, 0, 1, 1, 2, 1, 1, 0, 1, 1, 2, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 2, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 2, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 2, 1, 1, 0
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Nov 19 2009

Keywords

Comments

Conjecture: a(n) = 2 for infinitely many n. This is equivalent to the twin prime conjecture. - Andrew Slattery, Apr 26 2020

Crossrefs

Programs

  • Maple
    A168141 := proc(n) numtheory[pi](n+1)-numtheory[pi](n-2) ; end proc: seq(A168141(n),n=1..120) ; # R. J. Mathar, Nov 19 2009
    # second Maple program:
    a:= n-> add(`if`(isprime(n+i), 1, 0), i=-1..1):
    seq(a(n), n=1..120);  # Alois P. Heinz, Apr 28 2020
  • Mathematica
    Table[PrimePi[n + 1] - PrimePi[n - 2], {n, 100}] (* Wesley Ivan Hurt, Apr 26 2020 *)
  • PARI
    a(n) = primepi(n+1) - primepi(n-2); \\ Michel Marcus, Apr 27 2020

Formula

From Alois P. Heinz, Apr 28 2020: (Start)
a(n) = 2 <=> n in { 2,3 } union { A014574 }.
a(n) = 0 <=> n in A079364. (End)
Showing 1-2 of 2 results.