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.

A292438 Characteristic function of non-isolated nonprimes.

Original entry on oeis.org

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

Views

Author

Wesley Ivan Hurt, Mar 31 2018

Keywords

Comments

Non-isolated nonprimes in the sense that at least one of the two adjacent integers is also a nonprime.

Crossrefs

Programs

  • Mathematica
    a[0] = 1; a[1] = 1; a[2] = 0; a[n_] := 1 - (PrimePi[n - Mod[n + 1, 2]] - PrimePi[n - Mod[n + 1, 2] - 1]) (PrimePi[n + Mod[n + 1, 2]] - PrimePi[n + Mod[n + 1, 2] - 1]); Table[a[n], {n, 0, 100}]
  • PARI
    A292438(n) = if(n<2,1,!isprime(n)&&((!isprime(n-1))||(!isprime(n+1)))); \\ Antti Karttunen, Jul 02 2018

Formula

a(0)=1, a(1)=1, a(2)=0, a(n) = 1 - A010051(n-((n+1) mod 2)) * A010051(n+((n+1) mod 2)) for n > 2.
a(n) = 1 - (pi(n) - pi(n-2))*(pi(n+1) - pi(n-1)), for n>3, where pi = A000720. - Ridouane Oudra, Jan 10 2022

Extensions

More terms from Antti Karttunen, Jul 02 2018