cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A167489 Product of run lengths in binary representation of n.

Original entry on oeis.org

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
Offset: 0

Views

Author

Andrew Weimholt, Nov 05 2009

Keywords

Examples

			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.
		

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).
Differs from similar A284579 for the first time at n=56, where a(56) = 9, while A284579(56) = 5.

Programs

  • Haskell
    import Data.List (group)
    a167489 = product . map length . group . a030308_row
    -- Reinhard Zumkeller, Jul 05 2013
    
  • Mathematica
    Table[ Times @@ (Length /@ Split[IntegerDigits[n, 2]]), {n, 0, 100}](* Olivier Gérard, Jul 05 2013 *)
  • 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
  • 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).
    
  • 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
    

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

A227355 Product of run lengths in Zeckendorf representation of n.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 2, 1, 4, 3, 2, 2, 1, 5, 4, 3, 4, 2, 3, 2, 1, 6, 5, 4, 6, 3, 6, 4, 2, 4, 3, 2, 2, 1, 7, 6, 5, 8, 4, 9, 6, 3, 8, 6, 4, 4, 2, 5, 4, 3, 4, 2, 3, 2, 1, 8, 7, 6, 10, 5, 12, 8, 4, 12, 9, 6, 6, 3, 10, 8, 6, 8, 4, 6, 4, 2, 6, 5, 4, 6, 3, 6, 4, 2, 4, 3
Offset: 0

Views

Author

Antti Karttunen, Jul 08 2013

Keywords

Comments

The same sequence also gives the product for the lengths of zero-runs only, as by definition, no two consecutive 1's can occur in Fibonacci number system (aka Zeckendorf representation), thus any 1's present contribute just *1 to the total product.

Crossrefs

Programs

Formula

a(n) = A167489(A003714(n)) = A227350(A003714(n)).
a(A227352(A005408(n))) = A167489(n).
For n>= 3, a(A000045(n)) = n-2.

A227351 Permutation of nonnegative integers: map each number by lengths of runs of zeros in its Zeckendorf expansion shifted once left to the number which has the same lengths of runs (in the same order, but alternatively of runs of 0's and 1's) in its binary representation.

Original entry on oeis.org

0, 1, 3, 7, 2, 15, 6, 4, 31, 14, 12, 8, 5, 63, 30, 28, 24, 13, 16, 9, 11, 127, 62, 60, 56, 29, 48, 25, 27, 32, 17, 19, 23, 10, 255, 126, 124, 120, 61, 112, 57, 59, 96, 49, 51, 55, 26, 64, 33, 35, 39, 18, 47, 22, 20, 511, 254, 252, 248, 125, 240, 121, 123, 224
Offset: 0

Views

Author

Antti Karttunen, Jul 08 2013

Keywords

Comments

This permutation is based on the fact that by appending one extra zero to the right of Fibonacci number representation of n (aka "Zeckendorf expansion") and then counting the lengths of blocks of consecutive (nonleading) zeros we get bijective correspondence with compositions, and thus also with the binary representation of a unique n. See the chart below:
n A014417(n) A014417(A022342(n+1)) Runs of Binary number In dec.
[shifted once left] zeros with same runs = a(n)
0: ......0 ......0 [] .....0 0
1: ......1 .....10 [1] .....1 1
2: .....10 ....100 [2] ....11 3
3: ....100 ...1000 [3] ...111 7
4: ....101 ...1010 [1,1] ....10 2
5: ...1000 ..10000 [4] ..1111 15
6: ...1001 ..10010 [2,1] ...110 6
7: ...1010 ..10100 [1,2] ...100 4
8: ..10000 .100000 [5] .11111 31
9: ..10001 .100010 [3,1] ..1110 14
10: ..10010 .100100 [2,2] ..1100 12
11: ..10100 .101000 [1,3] ..1000 8
12: ..10101 .101010 [1,1,1] ...101 5
13: .100000 1000000 [6] 111111 63
Are there any other fixed points after 0, 1, 6, 803, 407483 ?

Crossrefs

Inverse permutation: A227352. Cf. also A003714, A014417, A006068, A048679.
Could be further composed with A075157 or A075159, also A129594.

Programs

Formula

a(n) = A006068(A048679(n)) = A006068(A106151(2*A003714(n))).
This permutation effects following correspondences:
a(A000045(n)) = A000225(n-1).
a(A027941(n)) = A000975(n).
For n >=3, a(A000204(n)) = A000079(n-2).
Showing 1-3 of 3 results.