Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A254379
Characteristic function of the even odious numbers (A128309).
4
0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1
OFFSET
0
COMMENTS
a(n) is also the characteristic function of A129771 (the odd evil numbers), offset by 1.
Cf. A228495 the characteristic function of the odd odious numbers (A092246).
The characteristic function of the odious numbers (A000069) is given by the Thue-Morse sequence (A010060).
FORMULA
a(n) = A059841(n)*A010060(n) = 1-A254651(n). - Antti Karttunen, Oct 01 2018
EXAMPLE
A128309 begins 2, 4, 8, hence this sequence begins 0, 0, 1, 0, 1, 0, 0, 0, 1.
MATHEMATICA
a[n_] := If[EvenQ[n] && OddQ[DigitCount[n, 2, 1]], 1, 0]; Array[a, 100, 0] (* Amiram Eldar, Aug 06 2023 *)
PROG
(PARI) a(n)=n%2==0 && hammingweight(n)%2 \\ Charles R Greathouse IV, May 09 2016
(Python)
def A254379(n): return (n&1^1)&n.bit_count() # Chai Wah Wu, Mar 09 2023
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Jeremy Gardiner, Jan 29 2015
STATUS
approved