A353865 Number of complete rucksack partitions of n. Partitions whose weak run-sums are distinct and cover an initial interval of nonnegative integers.
1, 1, 1, 2, 1, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 5, 2, 3, 4, 3, 2, 4, 3, 3, 4, 4, 3, 4, 3, 4, 5, 5, 4, 6, 4, 6, 5, 4, 5, 6, 5, 6, 7, 6, 5, 9, 6, 6, 7, 6, 8, 9, 6, 6, 8, 9, 7, 9, 9, 7, 10, 9, 8, 13, 7, 10, 11, 8, 9, 10, 11, 12, 9, 11, 9, 15, 12, 12, 19, 13, 16, 16
Offset: 0
Keywords
Examples
The a(n) compositions for n = 1, 3, 9, 15, 18: (1) (21) (4311) (54321) (543321) (111) (51111) (532221) (654111) (111111111) (651111) (7611111) (81111111) (111111111111111111) (111111111111111) For example, the weak runs of y = {7,5,4,4,3,3,3,1,1} are {}, {1}, {1,1}, {3}, {4}, {5}, {3,3}, {7}, {4,4}, {3,3,3}, with sums 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, which are all distinct and cover an initial interval, so y is counted under a(31).
Crossrefs
Programs
-
Mathematica
norqQ[m_]:=Sort[m]==Range[0,Max[m]]; msubs[s_]:=Join@@@Tuples[Table[Take[t,i],{t,Split[s]},{i,0,Length[t]}]]; Table[Length[Select[IntegerPartitions[n],norqQ[Total/@Select[msubs[#],SameQ@@#&]]&]],{n,0,15}]
-
PARI
a(n) = my(c=0, s, v); if(n, forpart(p=n, if(p[1]==1, v=List([s=1]); for(i=2, #p, if(p[i]==p[i-1], listput(v, s+=p[i]), listput(v, s=p[i]))); s=#v; listsort(v, 1); if(s==#v&&s==v[s], c++))); c, 1); \\ Jinyuan Wang, Feb 21 2025
Extensions
More terms from Jinyuan Wang, Feb 21 2025
Comments