Squared discrepancy of a digit frequency (source code)

= Squared discrepancy of a digit frequency
{title2=$\mathbb E[(f-p)^2]=p(1-p)/N$}

If $N$ independent trials give a specified digit with probability $p$, its observed fraction is $f=K/N$ with binomial count $K$. Since $\mathbb E[f]=p$ and $\operatorname{Var}(K)=Np(1-p)$, the <mean> squared discrepancy is the displayed inverse-sample-size law. Dividing by $p^2$ converts it to a relative squared discrepancy without changing the log-log slope. Nested prefixes are correlated; a single deterministic expansion's plotted discrepancies do not prove that its digits are independent or normally distributed in the number-theoretic sense.