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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A167489 Product of run lengths in binary representation of n. 18
1, 1, 1, 2, 2, 1, 2, 3, 3, 2, 1, 2, 4, 2, 3, 4, 4, 3, 2, 4, 2, 1, 2, 3, 6, 4, 2, 4, 6, 3, 4, 5, 5, 4, 3, 6, 4, 2, 4, 6, 3, 2, 1, 2, 4, 2, 3, 4, 8, 6, 4, 8, 4, 2, 4, 6, 9, 6, 3, 6, 8, 4, 5, 6, 6, 5, 4, 8, 6, 3, 6, 9, 6, 4, 2, 4, 8, 4, 6, 8, 4, 3, 2, 4, 2, 1, 2, 3, 6, 4, 2, 4, 6, 3, 4, 5, 10, 8, 6, 12, 8, 4, 8 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,4

LINKS

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

Index entries for sequences related to binary expansion of n

FORMULA

a(n) = A227349(n) * A227350(n) = A227355(A227352(2n+1)). - Antti Karttunen, Jul 25 2013

a(n) = A284558(n) * A284559(n) = A284582(n) * A284583(n). - Antti Karttunen, Apr 16 2017

EXAMPLE

a(56) = 9, because 56 in binary is written 111000 giving the run lengths 3,3 and 3x3 = 9.

a(99) = 12, because 99 in binary is written 1100011 giving the run lengths 2,3,2, and 2x3x2 = 12.

MATHEMATICA

Table[ Times @@ (Length /@ Split[IntegerDigits[n, 2]]), {n, 0, 100}](* Olivier Gérard, Jul 05 2013 *)

PROG

(Scheme)

(define (A167489 n) (apply * (binexp->runcount1list n)))

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

;; Antti Karttunen, Jul 05 2013

(Haskell)

import Data.List (group)

a167489 = product . map length . group . a030308_row

-- Reinhard Zumkeller, Jul 05 2013

(Python)

def A167489(n):

  '''Product of run lengths in binary representation of n.'''

  p = 1

  b = n%2

  i = 0

  while (n != 0):

    n >>= 1

    i += 1

    if ((n%2) != b):

      p *= i

      i = 0

      b = n%2

  return(p)

# Antti Karttunen, Jul 24 2013 (Cf. Python program for A227184).

(PARI) a(n) = {my(p=1, b=n%2, i=0); while(n!=0, n=n>>1; i=i+1; if((n%2)!=b, p=p*i; i=0; b=n%2)); p} \\ Indranil Ghosh, Apr 17 2017, after the Python Program by Antti Karttunen

CROSSREFS

Row products of A101211 and A227736 (for n > 0).

Cf. A167490 (smallest number with binary run length product = n).

Cf. A167491 (members of A167490 sorted in ascending order).

Cf. A227355, A227184, A227190.

Cf. A227349, A227350, A227352, A246588, A284558, A284559, A284582, A284583.

Differs from similar A284579 for the first time at n=56, where a(56) = 9, while A284579(56) = 5.

Sequence in context: A064742 A227185 A284579 * A256790 A256478 A106638

Adjacent sequences:  A167486 A167487 A167488 * A167490 A167491 A167492

KEYWORD

nonn,base

AUTHOR

Andrew Weimholt, Nov 05 2009

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 | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified May 24 18:18 EDT 2017. Contains 286997 sequences.