I am working on a bijection for integer partitions and would appreciate help with two steps.
First, I want to replace each occurrence of (4, 2, 1, 1) with (3, 3, 2). One complication is that the 4, 2, 1, and 1 need not be adjacent. For example, the input
{{4, 4, 2, 2, 1, 1, 1}, {4, 4, 2, 2, 2, 1}}
should lead to the output
{{4, 3, 3, 2, 2, 1}, {4, 4, 2, 2, 2, 1}}
since the first partition does include (4, 2, 1, 1), even with the extra 2, and the second does not.
Second, in a later step, I need a 2 and all ones, suppose there are $k$ of them, to be changed to the single number $k+2$, e.g., input
{{5, 2, 1, 1}, {4, 3, 1, 1}, {2, 2, 2, 1, 1, 1}}
should lead to the output
{{5, 4}, {5, 2, 2}, {4, 3, 1, 1}}.
Edit: I put the part 2 output in the standard reverse lexicographic order used for partitions, which unfortunately caused some confusion. Partition by partition, the intent is
{5, 2, 1, 1} $\mapsto$ {5, 4},
{4, 3, 1, 1} $\mapsto$ {4, 3, 1, 1},
{2, 2, 2, 1, 1, 1} $\mapsto$ {5, 2, 2}.
IntegerPartitions[n]
. $\endgroup$