What is the distribution of leading digits of the squares?

516 Views Asked by At

Inspired by How can 0.149162536... be normal?, I ask for the distribution of the leading coefficients of $1,4,9,16,25,36\ldots$. (namely $1,4,9,1,2,3\ldots$) Does a Benford-like law apply?

The online encyclopedia of integer sequences has it, and has a tantalizing link to something called Gelfand's question.

2

There are 2 best solutions below

2
On BEST ANSWER

Of the $n$ digit numbers, the leading digit of $m^2$ will be $1$ if $\frac m{10^{n-1}}$ is in the range $[1,\sqrt 2]$ or $[\sqrt {10},\sqrt{20}]$. The first will account for about $(\sqrt 2-1)10^{n-1}$, the second will account for $(\sqrt {20}-\sqrt{10})10^{n-1}$ out of $9\cdot 10^{n-1}$ numbers of that length, so going up to a given number of digits about $0.1916$ of all numbers up to $n$ digits have squares that start with $1$

The values for other leading digits can be computed similarly. The results are: $$\begin {array}{r | l} \text{leading digit} & \text{fraction} \\ \hline 1&0.191564\\2&0.146992\\3&0.12392\\4&0.109176\\5&0.098702\\6&0.090766\\7&0.084483\\8&0.079348\\9&0.075049\end{array}$$

These match user17762's result for up to $5$ digit numbers nicely.

3
On

The leading digit doesn't seem to follow Benford's law. Below is a plot, where the frequency of first digit from the squares of the first $1,000,000$ numbers are plotted.

The Benford law is $$p(d) \propto \log_{10}\left(1+\dfrac1{d}\right)$$

The empirical law given by $$p(d) \propto \log_{10}\left(1+\dfrac1{\sqrt{d}}\right)$$ seems to be a better fit.

enter image description here

\begin{array}{|c|c|c|c|} \hline \text{Digit} & \text{Benford's law} & \text{Frequency of $1^{st}$ digit of a square} & \text{Emperical law}\\ \hline 1 & 0.3010 & 0.1916 & 0.1867\\ 2 & 0.1761 & 0.1470 & 0.1441\\ 3 & 0.1249 & 0.1239 & 0.1228\\ 4 & 0.0969 & 0.1092 & 0.1092\\ 5 & 0.0792 & 0.0987 & 0.0996\\ 6 & 0.0669 & 0.0908 & 0.0922\\ 7 & 0.0580 & 0.0845 & 0.0864\\ 8 & 0.0512 & 0.0793 & 0.0816\\ 9 & 0.0458 & 0.0751 & 0.0775\\ \hline \end{array}