

A298644


The indices of the Carlitz compositions (i.e., compositions without adjacent equal parts).


11



1, 3, 4, 6, 7, 8, 9, 14, 15, 16, 17, 24, 27, 28, 30, 31, 32, 33, 35, 36, 39, 48, 49, 54, 55, 57, 59, 60, 62, 63, 64, 65, 67, 68, 70, 72, 73, 78, 79, 96, 97, 99, 110, 111, 112, 118, 119, 120, 121, 123, 124, 126, 127, 128, 129, 131, 132, 134, 135, 136, 137, 143, 144, 145, 156, 158
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

We define the index of a composition to be the positive integer whose binary form has runlengths (i.e., runs of 1's, runs of 0's, etc., from left to right) equal to the parts of the composition. Example: the composition [1,1,3,1] has index 46 since the binary form of 46 is 101110.
The command c(n) from the Maple program yields the composition having index n.


LINKS

Table of n, a(n) for n=1..66.


EXAMPLE

135 is in the sequence since its binary form is 10000111 and the composition [1,4,3] has no adjacent equal parts.
139 is not in the sequence since its binary form is 10001011 and the composition [1,3,1,1,2] has two adjacent equal parts.


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[i1] 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: pd := proc (n) options operator, arrow: product(c(n)[j]c(n)[j+1], j = 1 .. nops(c(n))1) end proc: A := {}; for n to 200 do if pd(n) <> 0 then A := `union`(A, {n}) else end if end do: A; # most of the Maple program is due to W. Edwin Clark


MATHEMATICA

With[{nn = 18}, TakeWhile[#, # <= Floor[2^(2 + nn/Log2[nn])] &] &@ Union@ Apply[Join, #] &@ Table[Map[FromDigits[#, 2] &@ Flatten@ MapIndexed[ConstantArray[Boole@ OddQ@ #2, #1] &, #] &, Select[Map[Flatten[Map[# /. w_List :> If[First@ w == 1, Length@ w + 1, ConstantArray[1, Length@ w]] &, Split@ #] /. {a__, b_List, c__} :> {a, Most@ b, c}] &@ PadLeft[#, n  1] &, IntegerDigits[Range[0, 2^n  1], 2]], FreeQ[Differences@ #, 0] &]], {n, 2, nn}]] (* Michael De Vlieger, Jan 24 2018 *)


CROSSREFS

Cf. A003242, A101211.
Sequence in context: A187953 A188024 A179872 * A075747 A143344 A007401
Adjacent sequences: A298641 A298642 A298643 * A298649 A298650 A298651


KEYWORD

nonn


AUTHOR

Emeric Deutsch, Jan 24 2018


STATUS

approved



