login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual Appeal: Please make a donation to keep the OEIS running. In 2018 we replaced the server with a faster one, added 20000 new sequences, and reached 7000 citations (often saying "discovered thanks to the OEIS").
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A227350 Product of lengths of runs of 0-bits in binary representation of n, or 1 if no nonleading zeros present. 7
1, 1, 1, 1, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 1, 4, 3, 2, 2, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 1, 5, 4, 3, 3, 4, 2, 2, 2, 3, 2, 1, 1, 2, 1, 1, 1, 4, 3, 2, 2, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 1, 6, 5, 4, 4, 6, 3, 3, 3, 6, 4, 2, 2, 4, 2, 2, 2, 4, 3, 2, 2, 2, 1, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,5

LINKS

Antti Karttunen, Table of n, a(n) for n = 0..8192

FORMULA

A167489(n) = a(n) * A227349(n).

A227193(n) = A227349(n) - a(n).

A227355(n) = a(A003714(n)).

A003714 gives the only terms k for which a(k) = A167489(k).

EXAMPLE

a(0) = 1, regardless whether one considers the binary representation of zero to have one zero or no digits at all, because also the empty product is 1. Similarly for any numbers of form (2^k)-1, where no nonleading 0-bits occur, the result of an empty product is always 1.

a(8) = 3, as 8 is "1000" in binary, and there is one run of three 0-bits present.

a(68) = 6, 68 is "1000100" in binary, there are one run of three 0-bits and one run of two 0-bits, thus 2*3 = 6.

MAPLE

a:= proc(n) local i, m, r; m, r:= n, 1;

      while m>0 do

        for i from 0 while irem(m, 2, 'h')=0 do m:=h od;

        while irem(m, 2, 'h')=1 do m:=h od;

        r:= r*max(i, 1)

      od; r

    end:

seq(a(n), n=0..100);  # Alois P. Heinz, Jul 11 2013

MATHEMATICA

a[n_] := Times @@ Length /@ Select[Split @ IntegerDigits[n, 2], #[[1]] == 0 &]; Array[a, 100, 0] (* Jean-Fran├žois Alcover, Mar 03 2016 *)

PROG

(Scheme)

(define (A227350 n) (apply * (bisect (reverse (binexp->runcount1list n)) (modulo n 2))))

(define (bisect lista parity) (let loop ((lista lista) (i 0) (z (list))) (cond ((null? lista) (reverse! z)) ((eq? i parity) (loop (cdr lista) (modulo (1+ i) 2) (cons (car lista) z))) (else (loop (cdr lista) (modulo (1+ i) 2) z)))))

(define (binexp->runcount1list n) (if (zero? n) (list) (let loop ((n n) (rc (list)) (count 0) (prev-bit (modulo n 2))) (if (zero? n) (cons count rc) (if (eq? (modulo n 2) prev-bit) (loop (floor->exact (/ n 2)) rc (1+ count) (modulo n 2)) (loop (floor->exact (/ n 2)) (cons count rc) 1 (modulo n 2)))))))

CROSSREFS

Cf. A023416 (sum of lengths of runs of 0-bits), A167489, A227349, A227355, A227193.

Sequence in context: A303915 A292582 A008479 * A107345 A000688 A295879

Adjacent sequences:  A227347 A227348 A227349 * A227351 A227352 A227353

KEYWORD

nonn,base,look

AUTHOR

Antti Karttunen, Jul 08 2013

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 December 15 13:27 EST 2018. Contains 318149 sequences. (Running on oeis4.)