login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A156659
Characteristic function of safe primes.
14
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,1
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
MATHEMATICA
Array[Boole[And[PrimeQ@ #, PrimeQ[(# - 1)/2]]] &, 105, 0] (* Michael De Vlieger, Dec 16 2017 *)
PROG
(Haskell)
a156659 n = fromEnum $ a010051 n == 1 && a010051 (n `div` 2) == 1
-- Reinhard Zumkeller, Sep 18 2011
(PARI) a(n) = isprime(n) && isprime(floor((n-1)/2)) \\ Iain Fox, Dec 17 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Feb 13 2009
STATUS
approved