login
Characteristic function of composite numbers: 1 if n is composite else 0.
32

%I #48 Feb 09 2024 10:10:59

%S 0,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,

%T 1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,

%U 1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1,1

%N Characteristic function of composite numbers: 1 if n is composite else 0.

%C a(n) = signum(A066246(n)), where signum = A057427. For n > 1: a(n) = 1 - A010051(n) = A005171(n).

%C a(n) = A057427(A086971(n)). - _Reinhard Zumkeller_, Dec 14 2012

%H Antti Karttunen, <a href="/A066247/b066247.txt">Table of n, a(n) for n = 1..65537</a>

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

%H <a href="/index/Eu#epf">Index entries for sequences computed from exponents in factorization of n</a>

%F For n>1 a(n) = 1-floor(1/A001222(n)). - _Enrique Pérez Herrero_, Aug 08 2012

%F a(n) = A065855(n)-A065855(n-1) = 1-A000720(n)+A000720(n-1). - _Chayim Lowen_, Jul 23 2015

%F Dirichlet g.f.: Sum_{n>=1} a(n)/n^s = Zeta(s)-1-P(s), where P is prime zeta. - _Enrique Pérez Herrero_, Aug 08 2012

%F a(n) = 1 if A001222(n) > 1, 0 otherwise. - _Antti Karttunen_, Nov 20 2017

%t A066247[n_]:=1-Boole[PrimeQ[n]]-KroneckerDelta[n, 1] (* _Enrique Pérez Herrero_, Oct 13 2010 *)

%t Table[Boole[CompositeQ[n]], {n, 1, 105}] (* _Jean-François Alcover_, Jan 25 2018 *)

%o (PARI) a(n)=!isprime(n)&&n>1 \\ _Charles R Greathouse IV_, Aug 21 2011

%o (Haskell)

%o a066247 1 = 0

%o a066247 n = 1 - a010051 n -- _Reinhard Zumkeller_, Feb 04 2012

%Y Cf. A001222, A002808, A010051, A005171.

%Y Cf. A065855 (partial sums).

%K nonn,easy

%O 1,1

%A _Reinhard Zumkeller_, Dec 09 2001