[go: up one dir, main page]

login
A295896
a(n) = 1 if there are no odd runs of 1's in the binary expansion of n followed by a 0 to their right, 0 otherwise.
6
1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1
OFFSET
0
FORMULA
a(0) = 1; and then after, for odd n, a(n) = a((n-1)/2), for even n, a(n) = 0 if A007814(1+(n/2)) is odd, otherwise a(n/2).
a(n) = A053866(A005940(1+n)) = A000035(A000203(A005940(1+n))).
a(n) = A295875(n) + A295895(n) mod 2.
EXAMPLE
Drawing the terms as a binary tree (the first six levels shown) helps in seeing where terms of A028982 (squares and twice squares) are located in Doudna-tree (A005940, at the positions where 1's occur here):
1
|
1
............../ \..............
0 1
....../ \...... ....../ \......
0 0 1 1
/ \ / \ / \ / \
/ \ / \ / \ / \
0 0 0 0 1 1 0 1
/ \ / \ / \ / \ / \ / \ / \ / \
0 0 0 0 0 0 0 0 1 1 0 1 0 0 1 1
MATHEMATICA
Array[Boole@ NoneTrue[Partition[PadRight[#, # + Boole[OddQ@ #] &@ Length@ #, ""] /. _?StringQ -> {0, 0}, 2, 2][[All, All, -1]] &@ Map[{First@ #, Length@ #} &, Split@ IntegerDigits[#, 2]], And[OddQ@ #1, #2 > 0] & @@ # &] &, 120, 0] (* Michael De Vlieger, Dec 02 2017 *)
PROG
(Scheme, with memoization-macro definec)
(definec (A295896 n) (cond ((zero? n) 1) ((odd? n) (A295896 (/ (- n 1) 2))) ((odd? (A007814 (+ 1 (/ n 2)))) 0) (else (A295896 (/ n 2)))))
CROSSREFS
Characteristic function of A295897.
Sequence in context: A189920 A318963 A350600 * A176918 A176890 A164057
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Dec 01 2017
STATUS
approved