login
A255817
Parity of A000788, which is the total number of ones in 0..n in binary.
1
0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0
OFFSET
0
COMMENTS
a(n) is also the parity of A115384.
a(n) is also the base 2 version of the process described in A256379.
LINKS
Jeffrey Shallit and Anatoly Zavyalov, Transduction of Automatic Sequences and Applications, arXiv:2303.15203 [cs.FL], 2023, see p. 5.
FORMULA
a(n) = A000788(n) mod 2 = (Sum_{k=0..n} A000120(k)) mod 2.
a(n) = A115384(n) mod 2 = (Sum_{k=0..n} A010060(k)) mod 2.
EXAMPLE
a(3) = 0, because there are an even number of ones in [0,1,10,11].
a(5) = 1, because there are an odd number of ones in [0,1,10,11,100,101].
MATHEMATICA
Boole @* OddQ /@ Accumulate@ Array[DigitCount[#, 2, 1] &, 120, 0] (* Michael De Vlieger, Mar 29 2023 *)
PROG
(Sage)
def A255817(N):
A = [0]
for n in range(1, N+1):
n2 = bin(n)[2:]
A.append(mod(A[-1]+sum([int(n2[j]) for j in range(len(n2))]), 2))
return A
A255817(120)
(Python)
def A255817(n): return ((n>>1)&1)^(n&1|((n+1).bit_count()&1^1)) # Chai Wah Wu, Mar 01 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Danny Rorabaugh, Apr 01 2015
STATUS
approved