OFFSET
1,2
COMMENTS
From Emeric Deutsch, Jan 25 2018: (Start)
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.
The command c(n) from the Maple program yields the composition having index n. (End)
LINKS
Reinhard Zumkeller and Gheorghe Coserea, Table of n, a(n) for n = 1..20000 (first 5000 terms from Reinhard Zumkeller)
FORMULA
a(Sum_{k=0..n} A032020(k)) = 2^n, for n>1. - Gheorghe Coserea, May 30 2017
MAPLE
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
MATHEMATICA
f[n_] := Unequal@@Length/@Split[IntegerDigits[n, 2]]; Select[Range[300], f] (* Ray Chandler, Oct 21 2011 *)
PROG
(Haskell)
import Data.List (group, nub)
a044813 n = a044813_list !! (n-1)
a044813_list = filter p [1..] where
p x = nub xs == xs where
xs = map length $ group $ a030308_row x
-- Reinhard Zumkeller, Mar 02 2013
(PARI)
is(n) = {
my(v = 0, hist = vector(1 + logint(n+1, 2)));
while(n != 0,
v = valuation(n, 2); n >>= v; n++;
hist[v+1]++; if (hist[v+1] >= 2, return(0));
v = valuation(n, 2); n >>= v; n--;
hist[v+1]++; if (hist[v+1] >= 2, return(0)));
return(1);
};
seq(n) = {
my(k = 1, top = 0, v = vector(n));
while(top < n, if (is(k), v[top++] = k); k++);
return(v);
};
seq(59) \\ Gheorghe Coserea, Nov 02 2015
(Python)
from itertools import groupby
def ok(n):
runlengths = [len(list(g)) for k, g in groupby(bin(n)[2:])]
return len(runlengths) == len(set(runlengths))
print([i for i in range(1, 264) if ok(i)]) # Michael S. Branicky, Jan 04 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Extended by Ray Chandler, Oct 21 2011
STATUS
approved