// output of ./demo/comb/binary-huffman-demo.cc: // Description: //% Partitions of 1 into n powers of 1/2: //% 1 == a[0]/1 + a[1]/2 + a[2]/4 + a[3]/8 + ... a[m]/(2^m) (for n>=1), //% n == a[0] + a[1] + a[2] + a[3] + ... + a[m]. //% Same as: binary Huffman codes (canonical trees) with n terminal nodes, //% a[k] is the number of terminal nodes of depth k. //% Reversed lexicographic order. //% See: //% Christian Elsholtz, Clemens Heuberger, Helmut Prodinger: //% "The number of Huffman codes, compact trees, and sums of unit fractions", //% arXiv:1108.5964 [math.CO], (30-August-2011). //% //% Cf. OEIS sequence A002572. arg 1: 10 == n [partitions of 1 into n powers of 1/2] default=10 arg 2: 1 == sq [whether to print sums] default=1 0: [ . 1 1 1 1 1 1 1 1 2 ] 1 = + 1/2 + 1/4 + 1/8 + 1/16 + 1/32 + 1/64 + 1/128 + 1/256 + 2/512 1: [ . 1 1 1 1 1 1 . 4 . ] 1 = + 1/2 + 1/4 + 1/8 + 1/16 + 1/32 + 1/64 + 4/256 2: [ . 1 1 1 1 1 . 3 2 . ] 1 = + 1/2 + 1/4 + 1/8 + 1/16 + 1/32 + 3/128 + 2/256 3: [ . 1 1 1 1 . 3 1 2 . ] 1 = + 1/2 + 1/4 + 1/8 + 1/16 + 3/64 + 1/128 + 2/256 4: [ . 1 1 1 1 . 2 4 . . ] 1 = + 1/2 + 1/4 + 1/8 + 1/16 + 2/64 + 4/128 5: [ . 1 1 1 . 3 1 1 2 . ] 1 = + 1/2 + 1/4 + 1/8 + 3/32 + 1/64 + 1/128 + 2/256 6: [ . 1 1 1 . 3 . 4 . . ] 1 = + 1/2 + 1/4 + 1/8 + 3/32 + 4/128 7: [ . 1 1 1 . 2 3 2 . . ] 1 = + 1/2 + 1/4 + 1/8 + 2/32 + 3/64 + 2/128 8: [ . 1 1 1 . 1 6 . . . ] 1 = + 1/2 + 1/4 + 1/8 + 1/32 + 6/64 9: [ . 1 1 . 3 1 1 1 2 . ] 1 = + 1/2 + 1/4 + 3/16 + 1/32 + 1/64 + 1/128 + 2/256 10: [ . 1 1 . 3 1 . 4 . . ] 1 = + 1/2 + 1/4 + 3/16 + 1/32 + 4/128 11: [ . 1 1 . 3 . 3 2 . . ] 1 = + 1/2 + 1/4 + 3/16 + 3/64 + 2/128 12: [ . 1 1 . 2 3 1 2 . . ] 1 = + 1/2 + 1/4 + 2/16 + 3/32 + 1/64 + 2/128 13: [ . 1 1 . 2 2 4 . . . ] 1 = + 1/2 + 1/4 + 2/16 + 2/32 + 4/64 14: [ . 1 1 . 1 5 2 . . . ] 1 = + 1/2 + 1/4 + 1/16 + 5/32 + 2/64 15: [ . 1 1 . . 8 . . . . ] 1 = + 1/2 + 1/4 + 8/32 16: [ . 1 . 3 1 1 1 1 2 . ] 1 = + 1/2 + 3/8 + 1/16 + 1/32 + 1/64 + 1/128 + 2/256 17: [ . 1 . 3 1 1 . 4 . . ] 1 = + 1/2 + 3/8 + 1/16 + 1/32 + 4/128 18: [ . 1 . 3 1 . 3 2 . . ] 1 = + 1/2 + 3/8 + 1/16 + 3/64 + 2/128 19: [ . 1 . 3 . 3 1 2 . . ] 1 = + 1/2 + 3/8 + 3/32 + 1/64 + 2/128 20: [ . 1 . 3 . 2 4 . . . ] 1 = + 1/2 + 3/8 + 2/32 + 4/64 21: [ . 1 . 2 3 1 1 2 . . ] 1 = + 1/2 + 2/8 + 3/16 + 1/32 + 1/64 + 2/128 22: [ . 1 . 2 3 . 4 . . . ] 1 = + 1/2 + 2/8 + 3/16 + 4/64 23: [ . 1 . 2 2 3 2 . . . ] 1 = + 1/2 + 2/8 + 2/16 + 3/32 + 2/64 24: [ . 1 . 2 1 6 . . . . ] 1 = + 1/2 + 2/8 + 1/16 + 6/32 25: [ . 1 . 1 5 1 2 . . . ] 1 = + 1/2 + 1/8 + 5/16 + 1/32 + 2/64 26: [ . 1 . 1 4 4 . . . . ] 1 = + 1/2 + 1/8 + 4/16 + 4/32 27: [ . 1 . . 7 2 . . . . ] 1 = + 1/2 + 7/16 + 2/32 28: [ . . 3 1 1 1 1 1 2 . ] 1 = + 3/4 + 1/8 + 1/16 + 1/32 + 1/64 + 1/128 + 2/256 29: [ . . 3 1 1 1 . 4 . . ] 1 = + 3/4 + 1/8 + 1/16 + 1/32 + 4/128 30: [ . . 3 1 1 . 3 2 . . ] 1 = + 3/4 + 1/8 + 1/16 + 3/64 + 2/128 31: [ . . 3 1 . 3 1 2 . . ] 1 = + 3/4 + 1/8 + 3/32 + 1/64 + 2/128 32: [ . . 3 1 . 2 4 . . . ] 1 = + 3/4 + 1/8 + 2/32 + 4/64 33: [ . . 3 . 3 1 1 2 . . ] 1 = + 3/4 + 3/16 + 1/32 + 1/64 + 2/128 34: [ . . 3 . 3 . 4 . . . ] 1 = + 3/4 + 3/16 + 4/64 35: [ . . 3 . 2 3 2 . . . ] 1 = + 3/4 + 2/16 + 3/32 + 2/64 36: [ . . 3 . 1 6 . . . . ] 1 = + 3/4 + 1/16 + 6/32 37: [ . . 2 3 1 1 1 2 . . ] 1 = + 2/4 + 3/8 + 1/16 + 1/32 + 1/64 + 2/128 38: [ . . 2 3 1 . 4 . . . ] 1 = + 2/4 + 3/8 + 1/16 + 4/64 39: [ . . 2 3 . 3 2 . . . ] 1 = + 2/4 + 3/8 + 3/32 + 2/64 40: [ . . 2 2 3 1 2 . . . ] 1 = + 2/4 + 2/8 + 3/16 + 1/32 + 2/64 41: [ . . 2 2 2 4 . . . . ] 1 = + 2/4 + 2/8 + 2/16 + 4/32 42: [ . . 2 1 5 2 . . . . ] 1 = + 2/4 + 1/8 + 5/16 + 2/32 43: [ . . 2 . 8 . . . . . ] 1 = + 2/4 + 8/16 44: [ . . 1 5 1 1 2 . . . ] 1 = + 1/4 + 5/8 + 1/16 + 1/32 + 2/64 45: [ . . 1 5 . 4 . . . . ] 1 = + 1/4 + 5/8 + 4/32 46: [ . . 1 4 3 2 . . . . ] 1 = + 1/4 + 4/8 + 3/16 + 2/32 47: [ . . 1 3 6 . . . . . ] 1 = + 1/4 + 3/8 + 6/16 48: [ . . . 7 1 2 . . . . ] 1 = + 7/8 + 1/16 + 2/32 49: [ . . . 6 4 . . . . . ] 1 = + 6/8 + 4/16 ct=50