login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A092339 Number of adjacent identical digits in the binary representation of n. 5
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; refs; listen; history; text; internal format)
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.

LINKS

Table of n, a(n) for n=0..101.

FORMULA

Recurrence: a(2n) = a(n) + [n even], a(2n+1) = a(n) + [n odd].

a(n) = A014081(n) + A056973(n).

For n>0, A227185(n) = a(n)+1.

a(n) = A080791(A003188(n)) [because the sequence gives the number of nonleading zeros in binary Gray code expansion of n] - Antti Karttunen, Jul 05 2013

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))

(Scheme) (define (A092339 n) (A080791 (A003188 n))) ;; Antti Karttunen, Jul 05 2013

CROSSREFS

Cf. A005811.

Sequence in context: A208568 A193804 A180424 * A079693 A117444 A257145

Adjacent sequences:  A092336 A092337 A092338 * A092340 A092341 A092342

KEYWORD

nonn,base

AUTHOR

Ralf Stephan, Mar 18 2004

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 11 15:12 EDT 2020. Contains 336428 sequences. (Running on oeis4.)