One fair die is rolled: let 'x' denote the number that comes up. We then roll 'x' dice(s), and let the sum of the resulting numbers be 'y'. Finally, roll 'y' dice(s) and let 'z' be the sum of the resulting 'y' numbers. Let the expected value of 'z' be 'a', we have to find 'a'.
=================================================================== My approach:-
for 'x' all numbers have same probability of occurring after that if we consider cases for 'y':
1 dice roll
2 dice(s) roll.. .
.
6 dice(s) roll
and sum up the possibilities we get something like this
sum expected probability(out of $6^7$)
1 7776
2 9072
3 10584
4 12348
5 14406
6 16807
7 11832
8 12507
9 13076
10 13482
11 13650
12 13482
13 12852
14 12897
15 12772
16 12453
17 11928
18 11207
19 10332
20 9387
21 8292
22 7101
23 5880
24 4697
25 3612
26 2667
27 1876
28 1251
29 786
30 462
31 252
32 126
33 56
34 21
35 6
36 1
6 is having maximum probability i.e. 16807 and then 'y'=6.
and we know that if we roll 6 dice(s) then the probability of sum that is maximum is 21
so 'z' should be 21 but this is not the answer can someone suggest any different approach
Call $x^*$ the outcome of the first dice. Then we throw $x^*$ independent dies whose outcome is $x_i$ and we call $y^*=\sum_{i=1}^{x^*}x_i$. Finally, we throw $y^*$ independent dices whose outcome is $y_i$ and we call $z=\sum_{i=1}^{y^*}y_i$. We are looking for $\mathbb{E}(z)$. So, we can do this using the Law of Iterated Expectations (LIE), as follows: $$\mathbb{E}(z)=\mathbb{E}\bigg(\sum_{i=1}^{y^*}y_i\bigg)=\mathbb{E}(\mathbb{E}(y_1+\dots+y_{y^*}\mid y^*))=\mathbb{E}(y^*\mathbb{E}(y_i))=\frac{21}{6}\mathbb{E}(y^*)$$ Where the second to last equality follows from the fact that each throw is independent and identically distributed, so $y^*$ determines the number of throws but not the outcome of each of them. To finish the problem then we can proceed again using the LIE as follows: $$\mathbb{E}(z)=\frac{21}{6}\mathbb{E}(y^*)=\frac{21}{6}\mathbb{E}\bigg(\sum_{i=1}^{x^*}x_i\bigg)=\frac{21}{6}\mathbb{E}(\mathbb{E}(x_1+\dots+x_{x^*}\mid x^*))=\frac{21}{6}\mathbb{E}(x^*\mathbb{E}(x_i))=\bigg(\frac{21}{6}\bigg)^3$$