|
Search: id:A092339
|
|
|
| A092339 |
|
Number of adjacent identical digits in the binary representation of n. |
|
+0 1
|
|
| 0, 0, 0, 1, 1, 0, 1, 2, 2, 1, 0, 1, 2, 1, 2, 3, 3, 2, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 3, 2, 3, 4, 4, 3, 2, 3, 2, 1, 2, 3, 2, 1, 0, 1, 2, 1, 2, 3, 4, 3, 2, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 3, 4, 5, 5, 4, 3, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 3, 4, 3, 2, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 3, 2, 3, 4, 5, 4, 3, 4, 3, 2
(list; graph; listen)
|
|
|
OFFSET
|
0,8
|
|
|
COMMENT
|
In binary: number of 00 blocks plus number of 11 blocks.
|
|
REFERENCES
|
J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 84.
|
|
FORMULA
|
Recurrence: a(2n) = a(n) + [n even], a(2n+1) = a(n) + [n odd].
|
|
EXAMPLE
|
60 in binary is 111100, it has 4 blocks of adjacent digits, so a(60)=4.
|
|
PROGRAM
|
(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
|
A014081(n) + A056973(n). Cf. A005811.
Adjacent sequences: A092336 A092337 A092338 this_sequence A092340 A092341 A092342
Sequence in context: A003406 A107063 A108423 this_sequence A079693 A117444 A015504
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
Ralf Stephan (ralf(AT)ark.in-berlin.de), Mar 18 2004
|
|
|
Search completed in 0.002 seconds
|