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.

A033015 Numbers whose base-2 expansion has no run of digits with length < 2.

Original entry on oeis.org

3, 7, 12, 15, 24, 28, 31, 48, 51, 56, 60, 63, 96, 99, 103, 112, 115, 120, 124, 127, 192, 195, 199, 204, 207, 224, 227, 231, 240, 243, 248, 252, 255, 384, 387, 391, 396, 399, 408, 412, 415, 448, 451, 455, 460, 463, 480, 483, 487, 496, 499, 504, 508, 511, 768
Offset: 1

Views

Author

Keywords

Comments

See A033016 and following for the variants in other bases, A043291 for run lengths equal to 2 (which has a very simple formula) and A033001 and following for the analog of the latter in other bases. - M. F. Hasler, Feb 01 2014
The number zero also satisfies the definition if we consider that its base-2 expansion is empty. - M. F. Hasler, Oct 06 2022
If we define row n as subset of terms with n bits, i.e., 2^(n-1) < a(k) < 2^n, then we get row n by duplicating the last bit (LSB) of the terms in row n-1 and appending twice the negated LSB to the terms in row n-2. This gives the FORMULA for the number of terms in row n. - M. F. Hasler, Oct 17 2022

Examples

			The first terms, written in binary, are: 11, 111, 1100, 1111, 11000, 11100, 11111, 110000, 110011, ...; cf. sequence A355280. - _M. F. Hasler_, Oct 06 2022
		

Crossrefs

Cf. A355280 (in binary).
Cf. A222813 (palindromes subsequence).
See A033001 for further cross-references.

Programs

  • Mathematica
    Select[Range[2000], Min[Length/@Split[IntegerDigits[#, 2]]]>1&] (* Vincenzo Librandi, Feb 05 2014 *)
  • PARI
    is(n)=my(t); if(n%2, t=valuation(n+1,2); if(t==1,return(0)); n>>=t); while(n, t=valuation(n,2); if(t==1,return(0)); n>>=t; t=valuation(n+1,2); if(t==1,return(0)); n>>=t); 1 \\ Charles R Greathouse IV, Mar 29 2013
    
  • PARI
    select( is_A033015(n)=!bitand(n=bitxor(n,n<<1),n<<1)&&bitand(n,3)!=2, [1..770]) \\ M. F. Hasler, Oct 06 2022 (replacing less efficient code from 2014)
    
  • PARI
    {A033015_row(n)=if(n>3, setunion([x*2+x%2|x<-A033015_row(n-1)], [x*4+3-x%2*3|x<-A033015_row(n-2)]), n>1, [2^n-1], [])} \\ "Row" of n-digit terms. For (very) large n one could use memoization rather than this naive recursive definition.
    concat(apply(A033015_row, [1..9])) \\ To get the "flattened" sequence. - M. F. Hasler, Oct 17 2022
    
  • Python
    from itertools import groupby
    def ok(n): return all(len(list(g)) >= 2 for k, g in groupby(bin(n)[2:]))
    print([i for i in range(1, 769) if ok(i)]) # Michael S. Branicky, Jan 04 2021
    
  • Python
    def A033015_row(n): # terms with n bits <=> in [2^(n-1) .. 2^n]
        return [[], [], [3], [7]][n] if n < 4 else sorted(
        [x*2+x%2 for x in A033015_row(n-1)] +
        [x*4+3-x%2*3 for x in A033015_row(n-2)]) # M. F. Hasler, Oct 17 2022
    print(sum((A033015_row(n)for n in range(11)),[]))

Formula

The number of n-bit terms is Fibonacci(n-1) = A000045(n-1). - M. F. Hasler, Oct 17 2022

Extensions

Extended by Ray Chandler, Dec 18 2009