OFFSET
0,8
COMMENTS
In binary: number of 00 blocks plus number of 11 blocks. (Note: the blocks can overlap. See the example below.)
REFERENCES
J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 84.
FORMULA
EXAMPLE
60 in binary is 111100, it has 4 blocks of adjacent digits, so a(60)=4.
Equally, 60's binary Gray code expansion is A003188(60)=34, 100010 in binary, which contains four zeros.
PROG
(PARI) a(n)=local(v); v=binary(n); sum(k=1, length(v)-1, v[k]==v[k+1])
(PARI) a(n)=if(n<1, 0, if(n%2==0, a(n/2)+(n>0&&(n/2)%2==0), a((n-1)/2)+((n-1)/2)%2))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ralf Stephan, Mar 18 2004
STATUS
approved