Solution:
Answer: 2−1+22012(1007)(10062013)
We want to calculate Γ=∑i=0∞i⋅P(max profit =i), where we consider the maximum profit Rosencrantz has at any point over the first 2013 coin flips. By summation by parts this is equal to ∑a=12013P(max profit ≥a).
Let pa be the probability that Rosencrantz' max profit is at least a and let En,a be the set of sequences of flips such that Rosencrantz first reaches a profit of a on exactly the nth flip. Let Qa+,Qa−,Qa be the sets such that after all 2013 flips Rosencrantz' final profit is (respectively) greater than, less than, or equal to a.
Then,
Γ=a=1∑2013P( max profit ≥a)=a=1∑2013n=a∑2013P(En,a)=a=1∑2013n=a∑2013P(En,a∩Qa+)+P(En,a∩Qa−)+P(En,a∩Qa).
By symmetry, P(En,a∩Qa+)=P(En,a∩Qa−) because, for any sequence in En,a∩Qa+, we can reverse all the flips after the nth flip to get a sequence in En,a∩Qa−, and vice-versa.
Furthermore, ∑n=a2013P(En,a∩Qa+)=P(Qa+) and ∑n=a2013P(En,a∩Qa)=P(Qa).
So we have
a=1∑2013P( max profit ≥a)=a=1∑2013(P(Qa)+2P(Qa+))
Since by symmetry P(Qa)=P(Q−a) and we have an odd number of flips, we have ∑a=12013P(Qa)=21.
Also P(Qa+)=220131∑k=⌈22014+a⌉2013(k2013).
So the rest is just computation. We have:
Γ=21+220121a=1∑2013k=⌈22014+a⌉∑2013(k2013)=21+220121k=1008∑2013a=1∑2k−2014(k2013)=21+220121k=1008∑2013(k2013)(k+k−2013−1)=21+220121k=1008∑20132013(k−12012)−2013(k2012)−(k2013)=21+220122013(10072012)−22012+(10072013)=2−1+22012(1007)(10062013).
So the answer is 2−1+22012(1007)(10062013) (for reference, approximately 35.3).