OFFSET
0,4
COMMENTS
The bijective encoding of nonordered partitions via compositions (ordered partitions) present in the binary expansion of n is explained in A227184.
It appears that a(4n+2) = a(2n+1). - Ralf Stephan, Jul 20 2013
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..8192
FORMULA
Defining formula:
a(0)=0; and for n>=1, a(n) = A029837(n+1) - (A005811(n)-1). [Because the largest part in the unordered partition in this encoding scheme is computed as (c_1 + (c_2-1) + (c_3-1) + ... + (c_k-1)) where c_1 .. c_k are the parts of the k-part composition that sum together as c_1 + c_2 + ... + c_k = A029837(n+1) (the binary width of n), so we subtract from the total binary width of n the number of runs (A005811) minus 1.]
Equivalently: a(n) = A092339(n)+1 for n>0.
EXAMPLE
12 has binary expansion "1100", for which the lengths of runs (consecutive blocks of 0- or 1-bits) are [2,2]. Converting this to a partition in the manner explained in A227184 gives the partition {2+3}. Its largest part is 3, thus a(12)=3, which is actually the first time when this sequence differs from A043276.
MATHEMATICA
Table[Function[b, Max@ Accumulate@ Prepend[If[Length@ b > 1, Rest[b] - 1, {}], First@ b] - Boole[n == 0]]@ Map[Length, Split@ Reverse@ IntegerDigits[ n, 2]], {n, 0, 120}] // Flatten (* Michael De Vlieger, May 09 2017 *)
PROG
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Jul 05 2013
STATUS
approved