cp's OEIS Frontend

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.

Showing 1-2 of 2 results.

A354580 Number of rucksack compositions of n: every distinct partial run has a different sum.

Original entry on oeis.org

1, 1, 2, 4, 6, 12, 22, 39, 68, 125, 227, 402, 710, 1280, 2281, 4040, 7196, 12780, 22623, 40136, 71121, 125863, 222616, 393305, 695059, 1227990, 2167059, 3823029, 6743268, 11889431, 20955548, 36920415, 65030404, 114519168, 201612634, 354849227
Offset: 0

Views

Author

Gus Wiseman, Jun 13 2022

Keywords

Comments

We define a partial run of a sequence to be any contiguous constant subsequence. The term rucksack is short for run-knapsack.

Examples

			The a(0) = 1 through a(5) = 12 compositions:
  ()  (1)  (2)    (3)      (4)        (5)
           (1,1)  (1,2)    (1,3)      (1,4)
                  (2,1)    (2,2)      (2,3)
                  (1,1,1)  (3,1)      (3,2)
                           (1,2,1)    (4,1)
                           (1,1,1,1)  (1,1,3)
                                      (1,2,2)
                                      (1,3,1)
                                      (2,1,2)
                                      (2,2,1)
                                      (3,1,1)
                                      (1,1,1,1,1)
		

Crossrefs

The knapsack version is A325676, ranked by A333223.
The non-partial version for partitions is A353837, ranked by A353838 (complement A353839).
The non-partial version is A353850, ranked by A353852.
The version for partitions is A353864, ranked by A353866.
The complete version for partitions is A353865, ranked by A353867.
These compositions are ranked by A354581.
A003242 counts anti-run compositions, ranked by A333489.
A011782 counts compositions.
A108917 counts knapsack partitions, ranked by A299702, strict A275972.
A238279 and A333755 count compositions by number of runs.
A275870 counts collapsible partitions, ranked by A300273.
A353836 counts partitions by number of distinct run-sums.
A353847 is the composition run-sum transformation.
A353851 counts compositions with all equal run-sums, ranked by A353848.
A353853-A353859 pertain to composition run-sum trajectory.
A353860 counts collapsible compositions, ranked by A354908.

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@ IntegerPartitions[n],UnsameQ@@Total/@Union@@Subsets/@Split[#]&]],{n,0,15}]

Extensions

Terms a(16) onward from Max Alekseyev, Sep 10 2023

A354905 First position of n in A354578, where A354578(k) is the number of integer compositions whose run-sums constitute the k-th composition in standard order (graded reverse-lexicographic, A066099).

Original entry on oeis.org

3, 0, 2, 8, 32, 68, 130, 290, 274, 580, 520, 1298, 2080, 1096, 2082, 4168, 2178, 4164, 4386, 35137, 8328, 8786, 10274, 8772, 16712, 20562, 8712, 16658, 33320, 41554, 33288, 82210, 34856, 66628, 33312, 66642, 34850, 69704, 140306, 133448, 69714, 74308, 133154
Offset: 0

Views

Author

Gus Wiseman, Jun 21 2022

Keywords

Comments

The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.
Every sequence can be uniquely split into a sequence of non-overlapping runs. For example, the runs of (2,2,1,1,1,3,2,2) are ((2,2),(1,1,1),(3),(2,2)), with sums (4,3,3,4).

Examples

			The terms and their corresponding compositions begin:
     3: (1,1)
     0: ()
     2: (2)
     8: (4)
    32: (6)
    68: (4,3)
   130: (6,2)
   290: (3,4,2)
   274: (4,3,2)
   580: (3,4,3)
   520: (6,4)
  1298: (2,4,3,2)
The inverse run-sum compositions for n = 2, 8, 32, 68, 130, 290:
  (2)   (4)     (6)       (43)     (62)       (342)
  (11)  (22)    (33)      (223)    (332)      (3411)
        (1111)  (222)     (4111)   (611)      (11142)
                (111111)  (11113)  (3311)     (32211)
                          (22111)  (22211)    (111411)
                                   (1111112)  (311112)
                                              (1112211)
		

Crossrefs

The standard compositions used here are A066099, run-sums A353847/A353932.
This is the position of the first appearance of n in A354578.
A011782 counts compositions.
A003242 counts anti-run compositions, ranked by A333489.
A005811 counts runs in binary expansion.
A353838 ranks partitions with all distinct run-sums, counted by A353837.
A353851 counts compositions with all equal run-sums, ranked by A353848.
A353852 ranks compositions with all distinct run-sums, counted by A353850.
A353853-A353859 pertain to composition run-sum trajectory.
A354904 lists positions of zeros in A354578, complement A354912.
A354908 ranks collapsible compositions, counted by A353860.

Programs

  • Mathematica
    nn=1000;
    stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    antirunQ[y_]:=Length[Split[y]]==Length[y];
    q=Table[Length[Select[Tuples[Divisors/@stc[n]],antirunQ]],{n,0,nn}];
    w=Last[Select[Table[Take[q+1,i],{i,nn}],Union[#]==Range[Max@@#]&]-1];
    Table[Position[w,k][[1,1]]-1,{k,0,Max@@w}]
Showing 1-2 of 2 results.