The question is here:
Roll N* 3-sided dice(0,0,1), roll them twice and choose a better result, what is the expected value?
If possible I would also like an answer for dice {0,1,2} or {1,2,3} if that matters
Edited:
Since I am not very sure about probabilities, I'm not sure my attempt is correct or not.
I tried to observe the case when the final result is 0: $P[0]=(\frac23)^{2N}$
When final result is 1, that is we get result 0,1 unordered. The probabilities should be something like:
$$P[1]=(\frac13)^{2N}*(_NC_1*2^{2N})$$
and hence by guessing I suspect with something similar to induction we could prove the probability on getting final result k(<=N)should be something like
$$P[k]=(\frac13)^{2N}*(_NC_k*2^{2(N-k)}]$$
and I stucked here. I think, if we can get this, then the expected result could be:
$$E = 3^{2N} * \sum_0^N (k*P[k]) = \sum_0^N (k*_NC_k*2^{2(N-k)})$$
but I'm not sure whether the logic flow is correct or not, as I didn't study probability in my college, and sorry for my formatting.

For the original question, you expect $\frac N3\ 1$'s on the first roll. You reroll the rest and expect $\frac {2N}9\ 1$'s for a total of $\frac {5N}9\ 1$'s For the second part, first notice that $\{0,1,2\}$ and $\{1,2,3\}$ are the same question-just add one to the values from the first to get the second. You need to specify whether you reroll the middle number, but the approach is the same. You expect $\frac N3$ of the top number and evenly distribute the rerolled dice.