For the math approach to the problem, let p be the probability of success for a roll (so p=2/3 here), and let q = 1–p. For n rolls (without any reroll) the expected number of successes is given by the sum
and this sum is equal to .
Now suppose that one reroll is allowed. There is a probability that every roll will be a success, in which case no reroll is needed. But in every other case, there is at least one failure, and the reroll gives an expected success of p (instead of the zero that it would be if no reroll were allowed). So the formula for the expected number of successes becomes
That can be simplified to
If you take p = 2/3 and n=4, this formula agrees with the formula (x+1-(2/3^x))*2/3 above, and gives the expected number of successes as
If you allow a second reroll, then as well as the case where no reroll is needed, there is also a case where one reroll is needed, and for all other cases you need both rerolls. So the formula for the expected number of successes becomes
I'll leave you to simplify that.