%I #43 Jan 04 2021 05:13:18
%S 1,3,4,6,7,8,14,15,16,24,28,30,31,32,35,39,48,49,55,57,59,60,62,63,64,
%T 67,79,96,97,111,112,120,121,123,124,126,127,128,131,135,143,159,192,
%U 193,223,224,225,239,241,247,248,249,251,252,254,255,256,259,263
%N Positive integers having distinct base-2 run lengths.
%C A005811(a(n)) = A165413(a(n)). - _Reinhard Zumkeller_, Mar 02 2013
%C From _Emeric Deutsch_, Jan 25 2018: (Start)
%C Also, the indices of the compositions that have distinct parts. For the definition of the index of a composition see A298644. For example, 223 is in the sequence since its binary form is 11011111 and the composition [2,1,5] has distinct parts. 100 is not in the sequence since its binary form is 1100100 and the parts of the composition [2,2,1,2] are not distinct.
%C The command c(n) from the Maple program yields the composition having index n. (End)
%H Reinhard Zumkeller and Gheorghe Coserea, <a href="/A044813/b044813.txt">Table of n, a(n) for n = 1..20000</a> (first 5000 terms from Reinhard Zumkeller)
%F a(Sum_{k=0..n} A032020(k)) = 2^n, for n>1. - _Gheorghe Coserea_, May 30 2017
%p Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: for i from 2 to nops(L) do if L[i] = L[i-1] then r[j] := r[j], L[i] else j := j+1: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: A := {}: for n to 300 do if nops(convert(c(n), set)) = nops(c(n)) then A := `union`(A, {n}) else end if end do: A; # most of the Maple program is due to _W. Edwin Clark_. - _Emeric Deutsch_, Jan 25 2018
%t f[n_] := Unequal@@Length/@Split[IntegerDigits[n,2]]; Select[Range[300],f] (* _Ray Chandler_, Oct 21 2011 *)
%o (Haskell)
%o import Data.List (group, nub)
%o a044813 n = a044813_list !! (n-1)
%o a044813_list = filter p [1..] where
%o p x = nub xs == xs where
%o xs = map length $ group $ a030308_row x
%o -- _Reinhard Zumkeller_, Mar 02 2013
%o (PARI)
%o is(n) = {
%o my(v = 0, hist = vector(1 + logint(n+1, 2)));
%o while(n != 0,
%o v = valuation(n, 2); n >>= v; n++;
%o hist[v+1]++; if (hist[v+1] >= 2, return(0));
%o v = valuation(n, 2); n >>= v; n--;
%o hist[v+1]++; if (hist[v+1] >= 2, return(0)));
%o return(1);
%o };
%o seq(n) = {
%o my(k = 1, top = 0, v = vector(n));
%o while(top < n, if (is(k), v[top++] = k); k++);
%o return(v);
%o };
%o seq(59) \\ _Gheorghe Coserea_, Nov 02 2015
%o (Python)
%o from itertools import groupby
%o def ok(n):
%o runlengths = [len(list(g)) for k, g in groupby(bin(n)[2:])]
%o return len(runlengths) == len(set(runlengths))
%o print([i for i in range(1, 264) if ok(i)]) # _Michael S. Branicky_, Jan 04 2021
%Y Cf. A030308, A298644.
%K nonn,base
%O 1,2
%A _Clark Kimberling_
%E Extended by _Ray Chandler_, Oct 21 2011