If you picked a number between $1$ to $10^n$ with no zero digits,find the probability that the digits' product is less than the number's square root?

177 Views Asked by At

What is the probability if you picked a number with no zero digits between $1$ to $10^n$ that the digits' product is less than the number's square root?

You can't pick a number like $371790$ because it has a zero.

An example for it being bigger than the square root is $\;2\times2\times2\times2\times9\times9>\sqrt{222299}.$

An example for it being smaller than the square root is ;$2\times2\times2\times2\times9\times2<\sqrt{222292}.$

If there is a limit of the probability as n goes to infinity, what is it?

4

There are 4 best solutions below

6
On BEST ANSWER

The probability goes to 0%. We can get this by converting products to sums via a logarithm.

Lemma: Let $p_n$ be the probability that an $n$ digit number with no zeros has its square root greater than the product of the digits. Then $$\lim_{n\rightarrow\infty}p_n = 0$$

On one hand, if $x$ is an $n$ digit number, then $x < 10^n$, so $\log_{10}(\sqrt{x}) < \frac{n}2$. On the other hand, if we choose a non-zero digit $d$ randomly from $\{1,\ldots,9\}$, we can consider the expectation $\mu$ of $\log_{10}(d)$. Computing this tells us $\mu$ is about $0.618$ - and, in particular, is greater than $\frac{1}2$ (since $9! > 10^{9/2}$ to be explicit). If we choose $n$ non-zero digits at random, the log of their product is the sum of their logs - hence has a mean of $n\mu$.

Therefore, the square root of a number being greater than the product of its digits requires that the average of $\log_{10}(d)$ over all of its digits (which are chosen uniformly at random) must be less than $\frac{1}2$ - and the central limit theorem assures us that, as $n$ gets large, the probability that such an average is beneath any threshold below the mean tends to $0$.

More strongly, since the log of the product of the digits is the sum of $n$ independently identically distributed variables (...with nice properties - like being finitely supported here), we can immediately apply the central limit theorem to see that $p_n$ tends to $0$ as desired.

To finish, let $q_n$ be the probability that a number with at most $n$ digits, all non-zero, has a square root greater than the product of its digits. Suppose we fix any $\varepsilon>0$ and some $k$ so that $p_n \leq \varepsilon$ for every $n > k$. Note that, as $n$ increases, the probability that an at most $n$ digit number has fewer than $k$ digits goes to zero - implying that $\lim_{n\rightarrow\infty}q_n \leq \varepsilon$ as well. This holds for every positive $\varepsilon$, so $q_n$ also goes to $0$. Note that this is a fairly weak bound - $q_n$ is an exponentially weighted average of the values of $p_n$, so follows $p_n$ quite closely.

This also implies that the product of digits is almost always greater than $n^{\alpha}$ for any $\alpha < \mu$ and is almost never greater than $n^{\beta}$ for any $\beta > \mu$. It's not clear what happens if we compare to $n^{\mu}$.


If we want an estimate of the probabilities $p_n$ for fixed $n$, we can approximate the average of the log of the digits as a normal distribution with mean $\mu$ and standard deviation $\frac{\sigma}{\sqrt{n}}$ where $\sigma$ is the standard deviation of the variable $\log_{10}(d)$ for a single digit. Note $\sigma \approx 0.3124$ if we compute it - so the probability of being less than $\frac{1}2$ is about the probability of a standard normal distribution producing a value as extreme as $\frac{\sqrt{n}(\mu - \frac{1}2)}{\sigma}$ (i.e. a value with this z-score). This can be written explicitly using the error function, but suffice to say, it's not very likely (the probability decays at least exponentially quickly as $n$ increases).

0
On

For single digit numbers, the number is never less than its square root, so $P_1 = 0$.

For two digit numbers, $1*1 < \sqrt{11}$, $1*2 < \sqrt{12}, 1*3 < \sqrt{13},$ but $1*4> \sqrt{14}$ and likewise through $19$, so $P($teens$) = 1/3$.

For $21, 22,$ it holds, but $2*3 > \sqrt{23}$ and so on through $29$.

$3*1 < \sqrt{31}$, but the rest fail.

$4*1, 5*1, 6*1, 7*1, 8*1, 9*1$ work, but $4*2, 5*2, 6*2, ...9*2$ and higher fail.

So in all, for $2$-digit numbers, $P_2 = 12/81$

Clearly it gets more complex from here.

0
On

I was curious about how the probability (when restricting to numbers $\le n$) varied with $n$ and ran a quick simulation. [Note that my $n$ is not the same as OP's $n$.]

enter image description here

The sequences of consecutive upward jumps appear around numbers with lots of $1$s, like $11111$ or $21111$.

import numpy as np
import pandas as pd
import plotnine as gg

def HasZeroDigit(n: int):
  return (0 in [int(x) for x in str(n)])

def ComputeDigitProduct(n: int):
  digits = [int(x) for x in str(n)]
  return np.product(digits)

def DigitProductLessThanSqrt(n: int):
  prod = ComputeDigitProduct(n)
  return prod < np.sqrt(n)

N_MAX = int(10e6)
n_list = []
result_list = []
for n in range(1, N_MAX+1):
  if HasZeroDigit(n):
    continue
  n_list.append(n)
  result_list.append(DigitProductLessThanSqrt(n))

result_df = pd.DataFrame({'n': n_list, 'digit_product_less_than_sqrt': result_list})
result_df['cumul_freq'] = result_df['digit_product_less_than_sqrt'].cumsum()
result_df['one'] = 1
result_df['cumul_total'] = result_df['one'].cumsum()
result_df = result_df.drop(columns='one')
result_df['cumul_proportion'] = result_df['cumul_freq'] / result_df['cumul_total']

(
    gg.ggplot(result_df, gg.aes(x='n', y='cumul_proportion'))
    + gg.geom_line()
    + gg.ggtitle('Proportion of numbers [without zeros] ≤ n\nwhose digit product is less than its sqrt')
)
0
On

Let's consider a slight variation. Let $P_n$ the probabily that a natural number choosen randomly among the numbers with exactly $n$ decimal digits (that is, in $[10^{n-1},10^n-1]$ none of which zero has that property. That is (taking decimal logarithms) we are interested in the event

$$ \frac{\log r}{n} < \frac{1}{2n} \log s\tag1$$

where $$r = d_0 \times d_1 \times \cdots d_{n-1}$$ $$s = d_0 + d_1 10 + d_2 10^2 + \cdots d_{n-1} 10^{n-1}$$

Then we can assume $d_i$ are iid , uniform in $[1,9]$. Let $c_i = \log(d_i)$. Let $\mu_c =E[c_i] = \frac{1}{9}\sum_{k=1}^9 \log (k)=0.61775$. Also, because $0\le c_i <1$ the variance is bounded: $\sigma_c^2 <1/4$ (actually $\sigma_c^2 =0.0867\cdots$).

Then, for large $n$, the LHS of $(1)$ tends to a gaussian $N( \mu_c, \sigma^2_c/n)$

For the RHS:

$$\frac{1}{2n} \log(s)=\frac{1}{2n}(n + x_n) \tag2$$

where $x_n = \frac{d_{n-1}}{10}+\frac{d_{n-2}}{100}+\cdots$. Hence $0<x_n<1$ and $ \frac12 -\frac{1}{2n}<\frac{1}{2n} \log(s)<\frac12$

Then for large $n$ the LHS will concentrate around $\mu_c=0.61775$ and the RHS will be below $0.5$, hence $P_n \to 0$.


Some numerical results:

enter image description here