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.

A156659 Characteristic function of safe primes.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Reinhard Zumkeller, Feb 13 2009

Keywords

Crossrefs

Programs

  • Haskell
    a156659 n = fromEnum $ a010051 n == 1 && a010051 (n `div` 2) == 1
    -- Reinhard Zumkeller, Sep 18 2011
    
  • Mathematica
    Array[Boole[And[PrimeQ@ #, PrimeQ[(# - 1)/2]]] &, 105, 0] (* Michael De Vlieger, Dec 16 2017 *)
  • PARI
    a(n) = isprime(n) && isprime(floor((n-1)/2)) \\ Iain Fox, Dec 17 2017

Formula

a(n) = if n and also (n-1)/2 is prime then 1 else 0;
a(A005385(n)) = 1; a(A156657(n)) = 0; a(A059456(n)) = 0.
a(n) = A010051(n)*A010051((n-1)/2).
A156875(n) = Sum_{k=1..n} a(k). - Reinhard Zumkeller, Feb 18 2009
a(n) = 1 iff A292936(n) > 1. - Antti Karttunen, Dec 15 2017