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.
%I A298644 #20 Mar 22 2018 10:18:11 %S A298644 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, %T A298644 57,59,60,62,63,64,65,67,68,70,72,73,78,79,96,97,99,110,111,112,118, %U A298644 119,120,121,123,124,126,127,128,129,131,132,134,135,136,137,143,144,145,156,158 %N A298644 The indices of the Carlitz compositions (i.e., compositions without adjacent equal parts). %C A298644 We define the index of a composition to be the positive integer whose binary form has run-lengths (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. %C A298644 The command c(n) from the Maple program yields the composition having index n. %H A298644 Alois P. Heinz, <a href="/A298644/b298644.txt">Table of n, a(n) for n = 1..25290</a> %e A298644 135 is in the sequence since its binary form is 10000111 and the composition [1,4,3] has no adjacent equal parts. %e A298644 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. %p A298644 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: 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_ %t A298644 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 *) %Y A298644 Cf. A003242, A101211. %K A298644 nonn %O A298644 1,2 %A A298644 _Emeric Deutsch_, Jan 24 2018