login
Characteristic function of positive integers not prime and not a power of 2.
1

%I #18 Mar 11 2025 17:28:48

%S 0,0,0,0,0,1,0,0,1,1,0,1,0,1,1,0,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,0,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,0,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 positive integers not prime and not a power of 2.

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

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

%F A111775(n) = 0 if and only if a(n) = 0.

%F A111787(n) = 0 if and only if a(n) = 0.

%F a(n) = 1 for n in A111774. - _Michel Marcus_, Aug 28 2017

%o (PARI) {a(n) = n>0 && !isprime(n) && n != 2^valuation(n, 2)}

%o (Python)

%o from sympy import isprime

%o def A202238(n): return int(not isprime(n) and bool((n&-n)^n)) # _Chai Wah Wu_, Mar 11 2025

%Y Cf. A010051, A111774, A111775, A111787, A209229.

%K nonn,easy

%O 1,1

%A _Michael Somos_, Dec 16 2011