expected value of "optimized coin flips": i pick a coin randomly and flip it over...

hamsterofdeath2

New member
Joined
Apr 30, 2018
Messages
9
expected value of "optimized coin flips": i pick a coin randomly and flip it over...

i have 4 coins, 2 heads, 2 tails.
the game goes as follows:
1. i pick a coin randomly and flip it over
2. i may remove as many tails coins as i wish
3. repeat steps 1,2,3 until there are only heads or tails left

i want to maximize the number of heads that remain at the end.
in order to determine which is the best strategy, my naive approach was to just go through the options since there aren't many.

after the first flip, i can have
1 heads + 3 tails
or
3 heads + 1 tails

let's look at the second case first.
i can either remove the tails coin and end the game with 3 heads, or i can leave it in the game and hope for 4/0.
if i leave things as they are, the next situation i end up in could be 2/2 again.

this leads to end endless recursion, meaning my calculation will never finish.
how can i calculate what the expected number of heads is in this scenario despite that?

(edited here because apparently i need a moderator to approve responses but not to edit my original post that i didn't need approval for
)
for clarification:
i have 4 coins flipped like this at the beginning: HHTT

another description of same problem (but on a larger scale) is this: https://projecteuler.net/problem=339

i'm trying to solve it. my algorithm is "done", but it never ends, and that means i never get a result. if i have a solution for a simple case, i can generalize it and solve the problem even for 2*10000 sheep, which is my goal.

i found a "solution" here:
https://math.stackexchange.com/questions/2759753/the-mabinogion-sheep-problem

and the same at some other sites, but they all don't work in real life because they contain endless recursions.
my math knowledge isn't sufficient to solve this, so i asked here. either there is a way to somehow turn the calculation into a finite one or there is an alternative approach to the entire problem.
 
Last edited:
What does this even mean, four coins , two heads, two tails. Two of the coins have two heads, and two of the coins have two tails?

If your math question is along the lines of what is the sum of an infinite series, do you know about limits?
 
i have 4 coins flipped like this at the beginning: HHTT

another description of same problem (but on a larger scale) is this: https://projecteuler.net/problem=339

i'm trying to solve it. my algorithm is "done", but it never ends, and that means i never get a result. if i have a solution for a simple case, i can generalize it and solve the problem even for 2*10000 sheep, which is my goal.

i found a "solution" here:
https://math.stackexchange.com/questions/2759753/the-mabinogion-sheep-problem

and the same at some other sites, but they all don't work in real life because they contain endless recursions.
my math knowledge isn't sufficient to solve this, so i asked here. either there is a way to somehow turn the calculation into a finite one or there is an alternative approach to the entire problem.
 
this is the problem i am trying to solve:

https://projecteuler.net/problem=339

the optimal solution is described here:

https://www.revolvy.com/main/index.php?s=Mabinogion sheep problem

now i tried to use that to calculate the expected number of sheep. however, that's not possible for me because the functions contain an endless loop

i found two sites explaining the same solution that i tried to use:
http://www.math.cornell.edu/~web6720/Kun_slides.pdf (check page 12, it sums of the functions)
https://math.stackexchange.com/ques...ce=google_rich_qa&utm_campaign=google_rich_qa



problem is, when you do this in real life, it never finishes. it gets trapped in loops like these (i use E instead of V here):

E(2,3) = [(2 / 5.0) * E(3,2)] + (3 / 5.0) * E(1,4)
E(1,4) = (1 / 5.0) * E(2,3) + [(4 / 5.0) * E(0,5)]

i could solve this via substitution, but i am lacking the skill to come up with a general solution
 
Last edited:
Top