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

A341389
Characteristic function of A158705, nonnegative integers with an odd number of even powers of 2 in their base-2 representation.
6
0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0
OFFSET
0
FORMULA
a(2n+1) = 1 - a(floor(n/2)) for n >= 0.
a(2n) = a(floor(n/2)) for n > 0 with a(0) = 0.
a(n) = (-1)^n*a(floor(n/4)) + n mod 2 for n > 0 with a(0) = 0.
a(n) = A000035(A139351(n)). - Antti Karttunen, Feb 10 2021
MATHEMATICA
Array[Mod[Total@ IntegerDigits[#, 4], 2] &, 105, 0] (* Michael De Vlieger, Mar 17 2021 *)
PROG
(PARI) A341389(n) = { my(c=0); while(n, c += (n%2); n >>= 2); (c%2); }; \\ Antti Karttunen, Feb 10 2021
(PARI) a(n) = sumdigits(n, 4) % 2; \\ Kevin Ryde, Feb 14 2021
CROSSREFS
Cf. A000035, A139351, A158704 (positions of zeros), A158705 (of ones).
Cf. A112539 (complement), A112865 (as +-1).
Sequence in context: A269027 A089809 A165211 * A188027 A359333 A193496
KEYWORD
nonn
AUTHOR
Mikhail Kurkov, Feb 10 2021
EXTENSIONS
Terms corrected by Antti Karttunen, Feb 10 2021
STATUS
approved