For given $n$ it is possible to calculate the expected number of turns
from an absorbing Markov chain on the integer partitions of $n$.

Each state of the Markov process corresponds to the ordered list of the number of equally colored balls.
The matrix of transition probabilities between the states is easily calculated according to rules 1 or 2,

e.g.
Removing from position 1, adding to position 2 : {3,1,1} -> {2,2,1}

with probability p = P(choosing position 1 out of all balls) * P(choosing position 2 out of remaining balls)
=3/5 * 1/2

Given the transition matrix with the unique absorbing state {n} and the initial state {1,1,1,...,1} it is possible to calculate
the expected number of turns before absorption.

This is done in the Mathematica program below. Here some results where the first number is n, the second the numerical result, and the third the exact fraction:

**Rule 1**

```
{{2, 1., 1},
{3, 4., 4},
{4, 10.3333, 31/3},
{5, 22.4852, 16729/744},
{6, 45.2173, 33913/750},
{7, 87.7733, 26707139046097/304274018880},
{8, 168.252, 129857255359868261/771803525388385},
{9, 322.292, 4555917617310039296830835441635/14135986803865219963776139264},
{10,620.346,822838635777324535445878391148603051494611/1326419190860455039655669536523314862820}}
```

Only the numerical values for n>10:

{{11, 1202.04}, {12, 2344.58}, {13, 4599.07}, {14, 9062.01},

{15, 17916.8}, {16, 35513.4},{17, 70522.1}, {18, 140231.},{19, 279122.}, {20, 555989.}}

**Rule 2**

```
{{2, 1., 1},
{3, 2.5, 5/2},
{4, 4.41667, 53/12},
{5, 6.6994, 2251/336},
{6, 9.31157, 866023/93005},
{7, 12.2249, 1009285097/82560060},
{8, 15.4166, 2246993235815929/145751872750176},
{9, 18.868, 2285085765293281062003190373/121108796080566797904702840},
{10, 22.5637, 618224636000595187350171250435705332105433100763641/27399140168645771065204844597274355963355735154297}}
```

Only the numerical values for n>10:

{{11, 26.4901}, {12, 30.6358}, {13, 34.9907}, {14, 39.546}, {15,
44.2936}, {16, 49.2266}, {17, 54.3383}, {18, 59.6231}, {19,
65.0754}, {20, 70.6904}}

**Program:**

```
(*
Defining Rule 1:
input : lst = Partition of n , e.g. {5,3,2,1} with n=11
k, m : Positions to be changed ; remove ball from position k and add to position m
output : list containing changed partition and probability for this change
E.g. PartMove[{5, 3, 2, 1}, 1, 3] -> {{4, 3, 3, 1}, 5/33}
*)
PartMove[lst_, k_, m_] :=
Module[{ll = lst, len = Plus @@ lst, prob},
prob = (ll[[k]]/len*ll[[m]]/(len - ll[[k]]));
ll[[k]] -= 1; ll[[m]] += 1;
If[ll[[k]] == 0, ll = Drop[ll, {k}]]; {Reverse[Sort[ll]], prob}]
(*Alternatively
Defining Rule 2:
input : lst = Partition of n , e.g. {5,3,2,1} with n=11
k, m : Positions to be changed ; add ball to position k and remove from position m
output : list containing changed partition and probability for this change
E.g. PartMove[{5, 3, 2, 1}, 1, 3] -> {{6, 3, 1, 1}, 5/33}
*)
PartMove[lst_, k_, m_] :=
Module[{ll = lst, len = Plus @@ lst, prob},
prob = (ll[[k]]/len*ll[[m]]/(len - ll[[k]]));
ll[[k]] += 1; ll[[m]] -= 1;
If[ll[[m]] == 0, ll = Drop[ll, {m}]]; {Reverse[Sort[ll]], prob}]
(*
Calculate all possible target partitions for a given partition with respective probabilities:
input : lst = Partition of n , e.g. {5,3,2,1} with n=11
output : list containing all possible changed partitions with their probabilities
Note: Depends on the chosen rule via PartMove
E.g. for rule 1:
Targets[{2, 1, 1}] -> {{{2, 2}, 1/6}, {{3, 1}, 1/3}, {{2, 1, 1}, 1/2}}
*)
Targets[lst_] := Module[{len = Length[lst], pairs, res},
If[len <= 1, {{lst, 1}},
pairs = Select[Tuples[Range[len], 2], #[[1]] != #[[2]] &];
res = Sort[PartMove[lst, #[[1]], #[[2]]] & /@ pairs];
{#[[1, 1]], Plus @@ (#[[2]] & /@ #)} & /@ SplitBy[res, First]]]
(* Define all possible states for chosen n (here n=4) *)
states = IntegerPartitions[4];
(* Define transition matrix PM for Markov chain *)
nn = Length[states];
Clear[PartIndex]; n = 1; (PartIndex[#] = n++) & /@ states;
PM = Table[0, {nn}, {nn}];
Do[(PM[[PartIndex[#[[1]]], k]] = #[[2]]) & /@
Targets[states[[k]]], {k, 1, nn}]
(* Define submatrix Q for transient state changes *)
Q = (Drop[#, 1] & /@ Drop[PM, 1]);
(* Calculate fundamental matrix NPM of absorbing Markov chain*)
NPM = Inverse[ IdentityMatrix[Length[Q]] - Q];
(*Calculate expected number t of turns when starting from {1,1,..,1} = states[[-1]] *)
t = Plus @@ (#[[-1]] & /@ NPM);
{N[t], t} (*numerical and exact value of t*)
```

3more comments