For a, imagine a pascal's triangle of height k+1, but instead of the standard digits we have 1 at the top, then (2/3) and (1/3) on the second row, then (2/3)^2, (2/3)(1/3), and (1/3)^2 on the third row, and so on.
The k+1th row will have be (2/3)^k*(1/3)^0, then (2/3)^(k-1)*(1/3)^1, then (2/3)^(k-2)*(1/3)^2, and so on until finishing with (2/3)^0*(1/3)^k. To adjust for the fact that the middle numbers are more likely, each of these values is multiplied by the corresponding value of the normal Pascal's triangle. The mean of these adjusted values is the expected value of the final length. Anyone know how to express this in a more traditional, concise form?
For b, do the above but square each value before multiplying by the corresponding value of the normal Pascal's triangle.
Which prompt are you using to generate these?