The Baum-Sweet Sequence (A086747 with a Twist)
Take in a positive integer n
and print the integers from 1 to n for which the Baum-Sweet sequence returns true. The Baum-Sweet sequence should return falsy if the binary representation of the number contains an odd number of consecutive zeros anywhere in the number, and truthy otherwise. For more information, click the link. Here's a couple of examples:
1 -> 1 -> Truthy
2 -> 10 -> Falsy
3 -> 11 -> Truthy
4 -> 100 -> Truthy (Even run of zeros)
Here's an example given n=32
Step 1: The Baum-Sweet sequence visualized for n=32
1 1 (1)
1 0 0 (2)
11 1 (3)
1 00 1 (4)
1 0 1 0 (5)
11 0 0 (6)
111 1 (7)
1 000 0 (8)
1 00 1 1 (9)
1 0 1 0 0 (10)
1 0 11 0 (11)
11 00 1 (12)
11 0 1 0 (13)
111 0 0 (14)
1111 1 (15)
1 0000 1 (16)
1 000 1 0 (17)
1 00 1 0 0 (18)
1 00 11 1 (19)
1 0 1 00 0 (20)
1 0 1 0 1 0 (21)
1 0 11 0 0 (22)
1 0 111 0 (23)
11 000 0 (24)
11 00 1 1 (25)
11 0 1 0 0 (26)
11 0 11 0 (27)
111 00 1 (28)
111 0 1 0 (29)
1111 0 0 (30)
11111 1 (31)
1 00000 0 (32)
So, after computing the Baum-Sweet sequence for n, take the numbers that were truthy for the sequence and collect them for the final result. For n=32
we would have:
[1, 3, 4, 7, 9, 12, 15, 16, 19, 25, 28, 31]
As the final answer.
This is code-golf, shortest byte count wins.