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-5 of 5 results.

A284558 Product / LCM of run lengths in binary representation of n: a(n) = A167489(n) / A284559(n).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 4, 2, 1, 2, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 2, 1, 2, 4, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 2, 1, 2, 1, 2, 4, 2, 1, 2, 1, 3, 1, 2, 1, 1, 1, 3, 1
Offset: 0

Views

Author

Antti Karttunen, Apr 14 2017

Keywords

Crossrefs

Programs

Formula

a(n) = A167489(n) / A284559(n).

A284560 a(n) = n minus (LCM of run lengths in binary representation of n) = n - A284559(n).

Original entry on oeis.org

0, 1, 1, 2, 4, 4, 4, 5, 7, 9, 9, 10, 11, 11, 11, 12, 14, 16, 17, 18, 20, 20, 20, 18, 23, 24, 25, 22, 26, 26, 26, 27, 29, 31, 29, 34, 35, 36, 33, 37, 39, 41, 41, 42, 43, 43, 43, 44, 43, 48, 49, 50, 51, 52, 49, 53, 51, 55, 53, 56, 57, 57, 57, 58, 60, 62, 63, 62, 66, 64, 68, 66, 71, 72, 73, 74, 75, 72, 75, 76, 78, 80, 81, 82, 84, 84, 84, 82, 87, 88, 89, 86
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2017

Keywords

Crossrefs

Cf. A284559.
Cf. A227190, A283972, A284581 for similar sequences.

Programs

Formula

a(n) = n - A284559(n).

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

A284569 a(n) = LCM of the lengths of runs of 1-bits in binary representation of n.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 2, 3, 3, 4, 5, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 2, 2, 2, 2, 2, 2, 2, 6, 3, 3, 3, 6, 4, 4, 5, 6, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 2, 3, 3, 4, 5, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 2, 2, 2, 6, 4, 3, 3, 3, 6, 3, 3, 6, 3, 4
Offset: 0

Views

Author

Antti Karttunen, Apr 14 2017

Keywords

Examples

			For n = 27, in binary A007088(27) = "11011", the lengths of runs of 1-bits are [2,2], thus a(27) = lcm(2,2) = 2.
For n = 55, in binary A007088(55) = "110111", the lengths of runs of 1-bits are [2,3], thus a(55) = lcm(2,3) = 6.
		

Crossrefs

Cf. A003714 (positions of ones).
Differs from A227349 for the first time at n=27, where a(27)=2, while A227349(27)= 4.
Differs from A038374 for the first time at n=55, where a(55) = 6, while A038374(55) = 3.

Programs

  • Scheme
    (define (A284569 n) (apply lcm (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2))))) ;; For bisect and binexp->runcount1list, see the Program section of A227349.
    (define (A284569 n) (A072411 (A005940 (+ 1 n))))

Formula

a(n) = A072411(A005940(1+n)).
a(n) = A227349(n) / A284562(n).

A356352 a(n) = GCD of run lengths in binary expansion of n.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 0

Views

Author

Rémy Sigrist, Oct 15 2022

Keywords

Comments

a(0) = 0 as the GCD of an empty list (we consider here that the binary expansion of 0 has no runs).

Crossrefs

Programs

  • Mathematica
    {0}~Join~Array[GCD @@ Map[Length, Split@ IntegerDigits[#, 2]] &, 104] (* Michael De Vlieger, Oct 17 2022 *)
  • PARI
    a(n) = { my (r=[]); while (n, my (v=valuation(n+n%2, 2)); n\=2^v; r=concat(v, r)); gcd(r) }
    
  • Python
    from math import gcd
    from itertools import groupby
    def a(n):
        if n == 0: return 0 # by convention
        return gcd(*(len(list(g)) for k, g in groupby(bin(n)[2:])))
    print([a(n) for n in range(87)]) # Michael S. Branicky, Oct 15 2022

Formula

a(A001196(n)) = 2*a(n).
a(2^k-1) = k for any k >= 0.
Showing 1-5 of 5 results.