OFFSET
1,1
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
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
The number of n-bit terms is Fibonacci(n-1) = A000045(n-1). - M. F. Hasler, Oct 17 2022
EXAMPLE
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
MATHEMATICA
Select[Range[2000], Min[Length/@Split[IntegerDigits[#, 2]]]>1&] (* Vincenzo Librandi, Feb 05 2014 *)
PROG
(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)), []))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Extended by Ray Chandler, Dec 18 2009
STATUS
approved