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.

A164292 Binary sequence identifying the twin primes (characteristic function of twin primes: 1 if n is a twin prime else 0).

Original entry on oeis.org

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

Views

Author

Carlos Alves, Aug 12 2009

Keywords

Comments

Similar to prime binary digit sequence A010051.
In decimal notation A164292=0.1646823906345389353962381...
See also A164293 (similar to prime decimal sequence A051006).
a(A001097(n))=1; a(A001359(n))=1; a(A006512(n))=1. - Reinhard Zumkeller, Mar 29 2010
Characteristic function of A001097. - Georg Fischer, Aug 04 2021

Crossrefs

Programs

  • Haskell
    a164292 1 = 0
    a164292 2 = 0
    a164292 n = signum (a010051' n * (a010051' (n - 2) + a010051' (n + 2)))
    -- Reinhard Zumkeller, Feb 03 2014
  • Mathematica
    Table[(PrimePi[n] - PrimePi[n - 1]) * Ceiling[(PrimePi[n + 2] - PrimePi[n + 1] + PrimePi[n - 2] - PrimePi[n - 3])/2], {n, 100}] (* Wesley Ivan Hurt, Jan 31 2014 *)
    Table[If[PrimeQ[n]&&AnyTrue[n+{2,-2},PrimeQ],1,0],{n,120}] (* Harvey P. Dale, Jan 04 2025 *)

Formula

a(n) = A057427(A010051(n)*(A010051(n-2)+A010051(n+2))), for n>2. - Reinhard Zumkeller, Mar 29 2010
a(n) = c(n) * ceiling(( c(n+2) + c(n-2) )/2), where c is the prime characteristic. - Wesley Ivan Hurt, Jan 31 2014