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”).

Characteristic function of A254614, numbers that are either odd or evil (or both).
3

%I #20 Aug 07 2023 02:13:09

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

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

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

%N Characteristic function of A254614, numbers that are either odd or evil (or both).

%C A254614 is the complement of A128309 (even odious numbers).

%C A254379 is the characteristic function of A128309.

%H Antti Karttunen, <a href="/A254651/b254651.txt">Table of n, a(n) for n = 0..65537</a>

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

%F a(n) = 1-A254379(n).

%e A254614 begins 0,1,3,5, hence this sequence begins 1,1,0,1,0,1.

%t a[n_] := If[OddQ[n] || !OddQ[DigitCount[n, 2, 1]], 1, 0]; Array[a, 100, 0] (* _Amiram Eldar_, Aug 07 2023 *)

%o (PARI) A254651(n) = bitor((n%2),!(hammingweight(n)%2)); \\ _Antti Karttunen_, Oct 01 2018

%o (Python)

%o def A254651(n): return (n&1^1)&n.bit_count()^1 # _Chai Wah Wu_, Mar 09 2023

%Y Cf. A128309, A254377, A254379, A254614, A254655 (run lengths).

%K nonn,base

%O 0

%A _Jeremy Gardiner_, Feb 04 2015

%E Name amended by _Antti Karttunen_, Oct 01 2018