login
A328981
Indicator function of numbers whose binary representation ends in an even positive number of 0's.
4
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
OFFSET
1
COMMENTS
The asymptotic mean of this sequence is 1/6. - Amiram Eldar, Jan 12 2021
FORMULA
a(n) = 1 - A096268(n - 1) - (n mod 2). - Velin Yanev, Nov 30 2019, Antti Karttunen, Jan 28 2023
a(A108269(n)) = 1. - Amiram Eldar, Jan 12 2021
a(n) = 1 - A359832(n). - Antti Karttunen, Jan 28 2023
MAPLE
a:= n-> `if`((t-> t>0 and t::even)(padic[ordp](n, 2)), 1, 0):
seq(a(n), n=1..120); # Alois P. Heinz, Dec 03 2019
MATHEMATICA
a[n_] := Boole[And @@ EvenQ[{n, IntegerExponent[n, 2]}]]; Array[a, 100] (* Amiram Eldar, Jan 12 2021 *)
PROG
(Python)
def A328981(n): return ((n&1)|((~n & n-1).bit_length()&1))^1 # Chai Wah Wu, Jan 24 2023
(PARI) A328981(n) = (!(n%2)&&!(valuation(n, 2)%2)); \\ Antti Karttunen, Jan 28 2023
CROSSREFS
Characteristic function of A108269.
Cf. A096268, A359832 (one's complement).
Sequence in context: A369426 A340599 A160753 * A369070 A024360 A025456
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 05 2019
STATUS
approved