Problem 121

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
ldesnogu
Posts: 17
Joined: Wed Jan 11, 2012 10:04 am

Re: Problem 121

Post by ldesnogu »

enderw88 wrote:Seems like the 4 turn example considers drawing 2 Blues and 2 Reds as a win. Or am I reading it incorrectly?
You are reading incorrectly :) You need 3 or 4 B to win.
Image
enderw88
Posts: 9
Joined: Tue Feb 07, 2012 4:18 am

Re: Problem 121

Post by enderw88 »

ldesnogu wrote:
enderw88 wrote:Seems like the 4 turn example considers drawing 2 Blues and 2 Reds as a win. Or am I reading it incorrectly?
You are reading incorrectly :) You need 3 or 4 B to win.

Thanks, woke up this morning with the solution. I love my subconscious!
Image
User avatar
thedoctar
Posts: 128
Joined: Fri Apr 15, 2011 11:57 am
Location: Sydney, Australia

Re: Problem 121

Post by thedoctar »

For 10 turns, can anyone confirm 124829/39916800 is the probability of winning

don't worry, solved it. Really silly error. forgot to add 1 to the limit of a range.
Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Image
fabas indulcet fames
PrimeRing
Posts: 5
Joined: Wed Jul 25, 2012 1:24 am

Re: Problem 121

Post by PrimeRing »

thedoctar wrote:For 10 turns, can anyone confirm 124829/39916800 is the probability of winning
That's odd. My program got the correct answer for 4 and 15 turns, but it says that 177299/39916800 is the probability of winning in 10 turns. Sure you didn't leave out an event?

(Of course, with the rounding caused by the assumption payouts are whole, it's likely that we would both get correct answers for the problem itself. Still, I'm curious why our answers for 10 are different.)
User avatar
PurpleBlu3s
Posts: 75
Joined: Mon Sep 19, 2011 6:49 pm

Re: Problem 121

Post by PurpleBlu3s »

PrimeRing wrote:
thedoctar wrote:For 10 turns, can anyone confirm 124829/39916800 is the probability of winning
That's odd. My program got the correct answer for 4 and 15 turns, but it says that 177299/39916800 is the probability of winning in 10 turns. Sure you didn't leave out an event?

(Of course, with the rounding caused by the assumption payouts are whole, it's likely that we would both get correct answers for the problem itself. Still, I'm curious why our answers for 10 are different.)
I get the same as you.
Image
CxDoo
Posts: 2
Joined: Sun Jul 21, 2013 1:22 pm

Re: Problem 121

Post by CxDoo »

As I believe I spent more time than necessary solving this problem due to vagueness of the formulation, I'd like to offer here two clarifications. Hopefully the next frustrated soul will have it easier.

1. This is not the problem you are looking for
A bag contains one red disc and one blue disc. In a game of chance a player takes a disc at random and its colour is noted. After each turn the disc is returned to the bag, an extra red disc is added, and another disc is taken at random.
I spent a day solving stated problem and for the life of me couldn't get 11/120 (example value). Not even close. After coming here and seeing other people have had issues with the formulation I dropped what I was doing and started solving the actual problem.

(on a side note, the problem as stated is interesting too)

I propose a clearer formulation below.

2. Four turns of what
If the game is played for four turns, the probability of a player winning is exactly 11/120...
Um, it's not. Unless turn means something else (not going to give hints here).
The probability 11/120 corresponds to three turns.

Suggested problem formulation:
A bag contains one red disc and one blue disc. In a game of chance in each turn: a player takes a disc at random; its colour is noted; the disc is returned to the bag; another red disc is added.

The player pays £1 to play and wins if they have taken more blue discs than red discs at the end of the game.

If the game is played for three turns, the probability of a player winning is exactly 11/120, and so the maximum prize fund the banker should allocate for winning in this game would be £10 before they would expect to incur a loss. Note that any payout will be a whole number of pounds and also includes the original £1 paid to play the game, so in the example given the player actually wins £9.

Find the maximum prize fund that should be allocated to a single game in which fifteen turns are played.
mdean
Posts: 206
Joined: Tue Aug 02, 2011 2:05 am

Re: Problem 121

Post by mdean »

I agree that maybe it should be clarified what a turn is. However, just doing the math in my head, I can see that value for 4 turns is correct. And even if I couldn't, I could see that 11/120 doesn't make sense for an answer after 3 turns.
Image
CxDoo
Posts: 2
Joined: Sun Jul 21, 2013 1:22 pm

Re: Problem 121

Post by CxDoo »

mdean wrote:I agree that maybe it should be clarified what a turn is. However, just doing the math in my head, I can see that value for 4 turns is correct. And even if I couldn't, I could see that 11/120 doesn't make sense for an answer after 3 turns.
You are right and I stand corrected.
huttarl
Posts: 2
Joined: Fri Feb 20, 2015 5:27 pm

Re: Problem 121

Post by huttarl »

Like some other people, I found the description of this problem difficult to understand. Here's where I struggled:
If the game is played for four turns, the probability of a player winning is exactly 11/120, and so the maximum prize fund the banker should allocate for winning in this game would be £10 before they would expect to incur a loss.
Here "the banker" is not defined. After some dead-end interpretations, I'm fairly confident now that "the banker" means the party that receives the player's entry fee and pays prize money to the player if the player wins. (Not a bank that loans the player money for gambling with and is trying to avoid inappropriate risk.) The banker is what we might call "the house" in Las Vegas terms.

More crucially, in the above quote, "this game" does not mean the disc game in general, but a 4-turn game. It's not that the player started playing and then only after the fourth turn made a decision to quit; instead he and the banker agreed from the outset to a 4-turn game, so the banker is basing the amount of the prize money on the number of turns agreed upon.

Am I right in understanding it this way?
User avatar
Georg
Posts: 157
Joined: Mon Jan 21, 2008 7:00 am
Location: Mannheim, Germany
Contact:

Re: Problem 121

Post by Georg »

Yes, and it is a good idea to call it an n-turn game.
jneb
Posts: 2
Joined: Mon Jul 11, 2016 9:51 am

Re: Problem 121

Post by jneb »

Tommy137 wrote:The payout's done after the complete game is played. If the player wins the four turn game, he gets £10 including his stake of £1.
I was so confused by this. I already completely solved the problem, but from the description I concluded that I had to subtract one from the result.
I almost gave up, until I understood that the payout you gave was including this initial payment, so you only have to round down. Sigh.
- Jurjen
MuthuVeerappanR
Posts: 539
Joined: Sun Mar 22, 2015 2:30 pm
Location: India
Contact:

Re: Problem 121

Post by MuthuVeerappanR »

If the banker allocates 10 for the 4-round game, his expected gain/loss is

1 * 109/120 - 10 * 11/120 = -1/120

Isnt he already incurring a loss??

Am I misinterpreting something??

Update: Solved it without understanding :) :) . But still I need my question answered..
Image
It is not knowledge, but the act of learning, not possession but the act of getting there, which grants the greatest enjoyment.
User avatar
hk
Administrator
Posts: 12831
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 121

Post by hk »

Suppose 120 games are played.
The player has paid 120 pound and we expect him to win 11 times.
So the bank pays him 11 times the prize fund.
So you must calculate floor(120/11)=10.
10*11=110<120. So there is no loss for the bank.
Image
War ruins the life and health of untold numbers of innocent children.
MuthuVeerappanR
Posts: 539
Joined: Sun Mar 22, 2015 2:30 pm
Location: India
Contact:

Re: Problem 121

Post by MuthuVeerappanR »

Oh... I see my mistake.. Thanks for the clarification hk.
Image
It is not knowledge, but the act of learning, not possession but the act of getting there, which grants the greatest enjoyment.
User avatar
hankinsohl
Posts: 12
Joined: Thu Nov 30, 2017 9:45 am

Re: Problem 121

Post by hankinsohl »

LarryC wrote: Sat Jul 05, 2008 12:39 pm Got it! Thanks for your help guys.
After each turn the disc is returned to the bag, an extra red disc is added, and another disc is taken at random.
This sentence is very ambiguous. It's primary meaning seems to imply that a disc is randomly removed after the turn and before the next. An example, similar to Tommy137's one, would go a long way! Or perhaps it should be rephrased.
I interpreted the problem the same way you did LarryC - that is, the number of discs in the bag is 2 throughout the game. I wasn't sure that this was the intended meaning though and came to these forums for clarification.
Image
gaonat
Posts: 1
Joined: Mon Jan 10, 2022 10:18 pm

Re: Problem 121

Post by gaonat »

Is the game over after a win is guaranteed, or is the game always played to completion?

For instance, in the 4-turn case, are BBBB and BBBR considered outcomes? Or does the game stop when a player gets BBB?
User avatar
neverforget
Posts: 88
Joined: Sat Sep 16, 2006 10:10 pm

Re: Problem 121

Post by neverforget »

gaonat wrote: Mon Jan 10, 2022 10:20 pm Is the game over after a win is guaranteed, or is the game always played to completion?

For instance, in the 4-turn case, are BBBB and BBBR considered outcomes? Or does the game stop when a player gets BBB?
The problem does not mention any way for the game to stop before reaching the turn limit.
Image
Allyne
Posts: 2
Joined: Wed Apr 24, 2024 9:23 am

Re: Problem 121

Post by Allyne »

huttarl wrote: Fri Feb 20, 2015 10:07 pm Like some other people, I found the description of this problem difficult to understand. Here's where I struggled:
If the game is played for four turns, the probability of a player winning is exactly 11/120, and so the maximum prize fund the banker should allocate for winning in this game would be £10 before they would expect to incur a loss.
Here "the banker" is not defined. After some dead-end interpretations, I'm fairly confident now that "the banker" means the party that receives the player's entry fee and pays prize money to the player if the player wins. (Not a bank that loans the player money for gambling with and is trying to avoid inappropriate risk.) The banker is what we might call "the house" in Las Vegas terms.

More crucially, in the above quote, "this game" does not mean the disc game in general, but a 4-turn game. It's not that the player started playing and then only after the fourth turn made a decision to quit; instead he and the banker agreed from the outset to a 4-turn game, so the banker is basing the amount of the prize money on the number of turns agreed upon.This strategy is used in mobile gambling and more


Am I right in understanding it this way?
Yes, you're interpreting it correctly. In this context, "the banker" refers to the party facilitating the game, similar to "the house" in a casino setting. And "this game" specifically refers to a 4-turn game, where both the player and the banker agree on the number of turns beforehand. So, the prize money is determined based on this agreed-upon structure. Your understanding aligns well with the intended meaning of the passage.
AlfyB
Posts: 2
Joined: Tue Aug 26, 2025 7:46 pm

Re: Problem 121

Post by AlfyB »

I was extremely frustrated by this problem, in how it gave no indication of how the payout is calculated. That is not supposed to be the difficult part, but having no idea and being given no clue of how to move from the probabilities (the core of the problem) to the actual answer felt really bad.
PierrotLeFou
Posts: 32
Joined: Tue Jun 10, 2025 2:42 am
Location: Montreal, Canada
Contact:

Re: Problem 121

Post by PierrotLeFou »

You may try to do a search on Google, you will probably find some hints about this problem.
Try: project euler problem 121
I'm always right ... until I'm wrong
Post Reply