Premium problem52. Statistics of n Coin Flips

Medium Locked

Flip a fair coin n times, where n is even. Return (expected_heads, std_dev, p_exactly_expected):

  • the expected number of heads
  • the standard deviation of the count
  • the probability of landing on exactly that expected number

The third value surprises people: the most likely single outcome still has a small probability, and it shrinks as n grows even though the distribution tightens around it.

Input

100

Output

(50.0, 5.0, 0.07958923738717877)

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)