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.

This page as a plain text file.
%I A156659 #24 Feb 10 2018 17:50:21
%S A156659 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 A156659 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 A156659 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 A156659 Characteristic function of safe primes.
%H A156659 R. Zumkeller, <a href="/A156659/b156659.txt">Table of n, a(n) for n = 0..10000</a>
%H A156659 Wikipedia, <a href="http://en.wikipedia.org/wiki/Safe_prime">Safe prime</a>
%H A156659 <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F A156659 a(n) = if n and also (n-1)/2 is prime then 1 else 0;
%F A156659 a(A005385(n)) = 1; a(A156657(n)) = 0; a(A059456(n)) = 0.
%F A156659 a(n) = A010051(n)*A010051((n-1)/2).
%F A156659 A156875(n) = Sum_{k=1..n} a(k). - _Reinhard Zumkeller_, Feb 18 2009
%F A156659 a(n) = 1 iff A292936(n) > 1. - _Antti Karttunen_, Dec 15 2017
%t A156659 Array[Boole[And[PrimeQ@ #, PrimeQ[(# - 1)/2]]] &, 105, 0] (* _Michael De Vlieger_, Dec 16 2017 *)
%o A156659 (Haskell)
%o A156659 a156659 n = fromEnum $ a010051 n == 1 && a010051 (n `div` 2) == 1
%o A156659 -- _Reinhard Zumkeller_, Sep 18 2011
%o A156659 (PARI) a(n) = isprime(n) && isprime(floor((n-1)/2)) \\ _Iain Fox_, Dec 17 2017
%Y A156659 Cf. A005385, A156660, A292936.
%K A156659 nonn
%O A156659 0,1
%A A156659 _Reinhard Zumkeller_, Feb 13 2009