login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A156659 Characteristic function of safe primes. 14

%I #24 Feb 10 2018 17:50:21

%S 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,

%T 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,

%U 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

%N Characteristic function of safe primes.

%H R. Zumkeller, <a href="/A156659/b156659.txt">Table of n, a(n) for n = 0..10000</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Safe_prime">Safe prime</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%F a(n) = if n and also (n-1)/2 is prime then 1 else 0;

%F a(A005385(n)) = 1; a(A156657(n)) = 0; a(A059456(n)) = 0.

%F a(n) = A010051(n)*A010051((n-1)/2).

%F A156875(n) = Sum_{k=1..n} a(k). - _Reinhard Zumkeller_, Feb 18 2009

%F a(n) = 1 iff A292936(n) > 1. - _Antti Karttunen_, Dec 15 2017

%t Array[Boole[And[PrimeQ@ #, PrimeQ[(# - 1)/2]]] &, 105, 0] (* _Michael De Vlieger_, Dec 16 2017 *)

%o (Haskell)

%o a156659 n = fromEnum $ a010051 n == 1 && a010051 (n `div` 2) == 1

%o -- _Reinhard Zumkeller_, Sep 18 2011

%o (PARI) a(n) = isprime(n) && isprime(floor((n-1)/2)) \\ _Iain Fox_, Dec 17 2017

%Y Cf. A005385, A156660, A292936.

%K nonn

%O 0,1

%A _Reinhard Zumkeller_, Feb 13 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 18:17 EDT 2024. Contains 371962 sequences. (Running on oeis4.)