Maximizing Winnings - Dice Roll Strategy

Let $p(n)$ be the probability of rolling a sum of $n$ on a single roll, so $$p(n)=\frac{1}{6}-\frac{|n-7|}{36}.$$ Then the expected value $e_i$ of the winnings while using the strategy that we stop only when we hit a sum of $i$ or greater is $$ e_i = \sum_{j=i,j \neq 7}^{12} p(j)\cdot j + \left(1-\frac{1}{6}-\sum_{j=i,j\neq 7}^{12} p(j) \right)e_i $$ Solving for $e_i$, we find $$e_2 = 35/6$$ $$e_3 = 208/35$$ $$e_4 = 202/33$$ $$e_5 = 19/3$$ $$e_6 = 85/13$$ $$e_7 = 20/3$$ $$e_8 = 20/3$$ $$e_9= 25/4$$ $$e_{10}=16/3$$ $$e_{11}=34/9$$ $$e_{12}=12/7$$ so the maximum occurs at $i=8$, which is the same as $i=7$.

Here is a python simulation for extra verification.

import math
import random

games = 10000000

strat= 2 # stop on strat or more
tots = 0

for i in range(games):
    done=0
    while(done=strat):
            done=1
    winning =0
    if (sum!=7):
        winning=sum

    tots = tots+winning

    if (i % 1000==0) and i>0:
        print i," ",tots*1./i

print tots*1./games

You can try it: output agrees with the exact calculated values above to very high precision.