Let a number be written in binary as
(1)
|
and define
(2)
|
as the number of digits blocks of 11s in the binary expansion of . For , 1, ..., is given by 0, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 1, 1, 2, 3, ... (OEIS A014081).
Now define
(3)
|
as the parity of the number of pairs of consecutive 1s in the binary expansion of . For , 1, ..., the first few values are 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, ... (OEIS A020985). This is known as the Rudin-Shapiro, or sometimes Golay-Rudin-Shapiro sequence.
The summatory sequence of is then defined by
(4)
|
giving the first few terms for , 1, ... as 1, 2, 3, 2, 3, 4, 3, 4, 5, 6, 7, 6, 5, 4, ... (OEIS A020986).
Interestingly, the positive integer occurs exactly times in the sequence, and the positions of in sequence are given by the number triangle
(5)
|
(OEIS A093573).
For the special case , can be computed using the formula
(6)
|
(Blecksmith and Laud 1995), giving for , 2, ... the values 2, 3, 3, 5, 5, 9, 9, 17, 17, 33, 33, 65, ... (OEIS A051032). This sequence is therefore pairs of terms of the sequence 2, 3, 5, 9, 17, ... (OEIS A000051; keeping only a single member of the initial term), i.e., numbers of the form .