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

A087116 Number of maximal groups of consecutive zeros in binary representation of n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Aug 14 2003

Keywords

Comments

The following four statements are equivalent: a(n) = 0; n = 2^k - 1 for some k; A087117(n) = 0; A023416(n) = 0.

Examples

			G.f. = 1 + x^2 + x^4 + x^5 + x^6 + x^8 + x^9 + 2*x^10 + x^11 + x^12 + x^13 + x^14 + ...
		

Crossrefs

Essentially the same as A033264.

Programs

  • Haskell
    a087116 0 = 1
    a087116 n = f 0 n where
       f y 0 = y
       f y x = if r == 0 then g x' else f y x'
               where (x', r) = divMod x 2
                     g z = if r == 0 then g z' else f (y + 1) z'
                           where (z', r) = divMod z 2
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Mathematica
    a[n_] := SequenceCount[IntegerDigits[n, 2], {Longest[0..]}];
    Table[a[n], {n, 0, 101}] (* Jean-François Alcover, Oct 18 2021 *)
  • PARI
    a(n) = if (n == 0, 1, hammingweight(bitxor(n, n>>1)) >> 1);
    vector(102, i, a(i-1))  \\ Gheorghe Coserea, Sep 17 2015
    
  • Python
    def A087116(n):
        return sum(1 for d in bin(n)[2:].split('1') if len(d)) # Chai Wah Wu, Nov 04 2016

Formula

a(n) = A033264(n) for n > 0 since strings of 0's alternate with strings of 1's. - Jonathan Sondow, Jan 17 2016
a(n) = a(2*n + 1) = a(4*n + 2) - 1, if n > 0. - Michael Somos, Nov 04 2016
a(n) = A069010(A003817(n)-n) for n > 0. - Chai Wah Wu, Nov 04 2016

A087118 Numbers having exactly one maximal group of consecutive zeros in binary representation of n.

Original entry on oeis.org

0, 2, 4, 5, 6, 8, 9, 11, 12, 13, 14, 16, 17, 19, 23, 24, 25, 27, 28, 29, 30, 32, 33, 35, 39, 47, 48, 49, 51, 55, 56, 57, 59, 60, 61, 62, 64, 65, 67, 71, 79, 95, 96, 97, 99, 103, 111, 112, 113, 115, 119, 120, 121, 123, 124, 125, 126, 128, 129, 131, 135, 143, 159, 191
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 14 2003

Keywords

Comments

A087116(a(n)) = 1.
a(n) = A043687(n-1) for 1 < n < 1000. - Georg Fischer, Oct 19 2018

Crossrefs

Programs

  • Maple
    0, seq(seq(seq(2^n - 2^b + 2^a - 1, a=0..b-1),b=n-1..1,-1),n=0..10); # Robert Israel, Oct 01 2015
  • Mathematica
    Table[2^n - 2^b + 2^a - 1, {n, 0, 10}, {b, n-1, 1, -1}, {a, 0, b-1}] // Flatten // Prepend[#, 0]& (* Jean-François Alcover, Apr 11 2019, after  Robert Israel *)
  • PARI
    num(a,b,c) = (1 << (a+b+c)) - (1 << (b+c)) + (1 << c)  - 1;
    succ(a,b,c) = {
        if (b > 1, return([a, b-1, c+1]));
        if (c > 0, return([a+1, c, 0]));
        return([1, a+1, 0]);
    };
    seq(n) = {
        my(a = 1, b = 1, c = 0, v = vector(n));
        for (i = 2, n, v[i] = num(a,b,c);
             my(x = succ(a,b,c)); a = x[1]; b = x[2]; c = x[3]);
        return(v);
    };
    seq(64)  \\ Gheorghe Coserea, Sep 28 2015

Formula

From Gheorghe Coserea, Sep 28-30 2015: (Start)
a((n^3 - n)/6 + 2) = 2^n for n >= 1.
a((n^3 - n)/6 + 2 + n) = 2^n + 2^(n-1) for n >= 2.
a((n^3 - n)/6 + 2 + n + n-1) = 2^n + 2^(n-1) + 2^(n-2) for n >= 3.
a(n) < 2*2^((6*n)^(1/3)) and limsup a(n)/2^((6*n)^(1/3)) = 2.
a(n) > 1/2 * 2^((6*n)^(1/3)) for n>=3 and 1/2 <= liminf a(n)/(2^((6*n)^(1/3))) <= 1.
(End)
Showing 1-2 of 2 results.