I came across with the problem of calculating the expected sum of two fair dice where if the two numbers are the same, the sum is zero. This can be done by simply summing all possible cases and then divided by 36. However, I got trapped by the case with three dice.
So the “cancel” rule works like this: if you roll (1,1,2) then your sum is 2, if you roll (1,1,1) then your sum is 1, since in the second case you only need to cancel two of the three 1’s.
What I have tried so far is I try to minus all the over-counted sum from sum of all possible sums, and then divided by 216. Not sure if there is simpler way, because I was expected to answer in a short time.
And the case can be further generalised to rolling 100 dice and cancel each pair of the same number…
Let $E_n$ be the expected result of $n$ dice rolls after cancelling repeated numbers is pairs. If $P_n$ is the probability that a given number $x$ comes up an odd number of times, then $$E_n=\sum_{x=1}^6xP_n=21P_n.$$ Now we have to find a formula for $P_n$. Let $p=\frac16$, let $q=1-p$, and let $x=\frac pq$. Then $$P_n=\binom n1pq^{n-1}+\binom n3p^3q^{n-3}+\binom n5p^5q^{n-5}+\cdots$$ $$=q^n\left[\binom n1x+\binom n3x^3+\binom n5x^5+\cdots\right].$$ Now $\binom n1x+\binom n3x^3+\binom n5x^5+\cdots$ is the odd part of the binomal series $$1+\binom n1x+\binom n2x^2+\binom n3x^3+\binom n4x^4+\cdots=(1+x)^n=f(x),$$ so $$\binom n1x+\binom n3x^3+\binom n5x^5+\cdots=\frac{f(x)-f(-x)}2=\frac{(1+x)^n-(1-x)^n}2=\frac{1-(q-p)^n}{2q^n}$$ and $$P_n=\frac{1-(q-p)^n}2=\frac{1-\left(\frac23\right)^n}2$$ and finally $$E_n=21P_n=\frac{21}2\left[1-\left(\frac23\right)^n\right].$$ So $E_0=0$, $E_1=\frac72$, $E_2=\frac{35}6$, $E_3=\frac{133}{18}$, etc.
More generally, for dice with $s$ sides numbered from $1$ to $s$, the corresponding expected value is $$E_{n,s} = \binom{s+1}2\frac{1-\left(\frac{s-2}s\right)^n}2.$$