Standard deviation of flipping coins My question deals with flipping a coin.
I figured out that in one session of flipping a coin 400 times, the standard deviation for a 95% confidence interval is 20. I understand this to mean that (95% of the time) tails could come up 220 times and heads 180 or vice versa. I would like to isolate tails in my question. I want to know the optimal number (aka consistently) where tails occurs more than heads within that 400 flip session. 
It's hard to put into words but I want to know (like with 90% confidence or so) the greatest number tails occurs more than heads consistently throughout multiple 400 flip sessions. 
I.E. In programming type language...
T=tails
H=heads
Flip coin 400 times. 
Stop flipping when T>or= to H by what number? where it can stop consistently in multiple flipping sessions.
Thanks so much,
jared
 A: Empirically (a quarter of a million tries), about $92\%$ of your attempts will reach a point at which the number of tails exceeds the number of heads by $2$. By comparison, only about $88\%$ of attempts will ever reach a point where at which the number of tails exceeds the number of heads by $+3$, while about $96\%$ of attempts reach $+1$ at some stage.  
This would not be a good way of trying to win money: in the roughly $8\%$ of cases that you completely fail to ever reach $\text{tails}-\text{heads}=+2$ in your $400$ flips, your expected final outcome is about $-23$.  So overall, your expected gain is about $2 \times 0.92 - 23 \times 0.08=0$, as would be theoretically expected.
These empirical numbers come from the following R code:
> set.seed(1)
> n <- 250000
> dat <- matrix(rbinom(n*400, size=1, prob=1/2)*2-1, ncol=400)
> cumdat <- matrix(rep(0,n*401), ncol=401)
> for (i in 1:400){ cumdat[,i+1] <- cumdat[,i] + dat[,i] }
> maxdat <- apply(cumdat, 1, max)
> quantile(maxdat, 0.1)
10% 
  2 
> mean(maxdat >= 2)
[1] 0.920776
> mean(maxdat >= 3)
[1] 0.880796
> mean(maxdat >= 1)
[1] 0.960792
> mean(cumdat[maxdat < 2, 401])
[1] -23.18217

Incidentally, in your initial statement the standard deviation is in fact $\sqrt{400 \times \frac12 \times \frac12} = 10$; it is taking roughly two standard deviations for a $95\%$ confidence interval which leads you to an interval of between about $180$ and $220$.
