ndice, with each number 1 to 6 equally likely on each die.
- Check if their sum equals the most probable sum for
ndice, that is
- If they're equal, terminate.
- Otherwise, print
n, and repeat from the start with
Your code doesn't have to do this procedure exactly, but should give random output probabilistically equivalent to it, based on our definition of randomness.
Your program should output all of the numbers on their own line; for example, if the program got up to 8 dice and rolled the most probable number with 8 dice, the output would be:
2 4 6
On 2 dice,
7 is the most probable sum. Let's say the numbers rolled were
3. Then, you would print
On 4 dice,
14 is the most probable sum. Let's say the numbers rolled were
5. Then, the sum is
14, so the program would terminate here.
The final output in this case is