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-4 of 4 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

A087120 Smallest numbers having in binary representation exactly n maximal groups of consecutive zeros.

Original entry on oeis.org

1, 0, 10, 42, 170, 682, 2730, 10922, 43690, 174762, 699050, 2796202, 11184810, 44739242, 178956970, 715827882, 2863311530, 11453246122, 45812984490, 183251937962, 733007751850, 2932031007402, 11728124029610, 46912496118442
Offset: 0

Views

Author

Reinhard Zumkeller, Aug 14 2003

Keywords

Comments

A087116(a(n))=n and A087116(k)
For n>1, a(n) = A020988(n-1).

Crossrefs

Programs

  • Mathematica
    Join[{1,0},NestList[4#+2&,10,25]] (* Harvey P. Dale, Apr 20 2019 *)

Formula

a(0)=1, a(1)=0, a(2)=10, a(n)=4*a(n-1)+2.

A087119 Numbers having more than one maximal group of consecutive zeros in binary representation of n.

Original entry on oeis.org

10, 18, 20, 21, 22, 26, 34, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 50, 52, 53, 54, 58, 66, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 98, 100, 101, 102, 104, 105, 106, 107, 108, 109, 110, 114, 116, 117, 118, 122
Offset: 1

Author

Reinhard Zumkeller, Aug 14 2003

Keywords

Comments

A087116(a(n)) > 1.

Crossrefs

A356647 Concatenation of runs {y..x} for each x>=1, using each y from 1 to x before moving on to the next value for x.

Original entry on oeis.org

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

Author

Jonathan Kal-El Peréz, Aug 19 2022

Keywords

Comments

Alternate definition: Flattened list of all suffixes (ordered longest to shortest) of the list of all prefixes (ordered shortest to longest) of the list of positive integers. A prefix here is defined as any contiguous sublist of a list which includes the first element, and a suffix as any contiguous sublist of a list which includes the last element.
Also, concatenation of runs A002260(n)..A002024(n) for each n>=1.

Examples

			1
1 2
_ 2
1 2 3
_ 2 3
_ _ 3
1 2 3 4
_ 2 3 4
_ _ 3 4
_ _ _ 4...
		

Crossrefs

Programs

  • JavaScript
    a=n=>{for(let i=1;++i;){for(let j=0;++j
    				
  • MATLAB
    function a = A356647( max_x )
        a = cell2mat(arrayfun(@(x)(cell2mat(arrayfun(@(y)([y:x]),[1:x],'UniformOutput', false))) ...
            ,[1:max_x],'UniformOutput', false));
    end % Thomas Scheuerle, Sep 30 2022
    
  • Mathematica
    Print @ Flatten @ (Reverse@FoldList[Join[#2,#]&, {#}&/@Reverse@#]& /@ FoldList[Join, Table[{n},{n,1,10}]])
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        for k in count(1):
            for j in range(1, k+1):
                yield from range(j, k+1)
    print(list(islice(agen(), 87))) # Michael S. Branicky, Oct 11 2022

Formula

a(n) = A000120(A087118(n + 1)). - Thomas Scheuerle, Feb 16 2023
a(n*(n^2 + 5)/6) = a(A004006(n)) = n. This is the earliest appearance of n. - Thomas Scheuerle, Sep 30 2022
Showing 1-4 of 4 results.