OFFSET
0
COMMENTS
LINKS
Danny Rorabaugh, Table of n, a(n) for n = 0..10000
Jeffrey Shallit and Anatoly Zavyalov, Transduction of Automatic Sequences and Applications, arXiv:2303.15203 [cs.FL], 2023, see p. 5.
FORMULA
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