1

My first assumptions were not correct. I am looking for an intuitive explanation for the average of the following formula as well as what that average is if one were to run every number combination through this. $$\frac{n+1 \text{ digits}}{n \text{ digits}}$$ The numerator can be any number as long as it has one more digit than the denominator; the denomination can be any number as long as it has one fewer digit than the numerator.

An example would be 1,234/123 or 678,524/17,647

I have run this in a monte-carlo type scenario and the answer I keep getting is just slightly off from my expected value. Also the expected value was off from my initial intuition.

Joe
  • 546
  • 1
    Wait, is $n$ fixed or not? – Randall Nov 16 '24 at 01:46
  • Ill add to the details above, as an example 1,000 through 9,999 can be in the numerator and 100 through 999 would have to be in the denominator. But you can also do it for 1,000,000 through 9,999,999 in the numerator and 100,000 through 999,999 in the denominator. the average between the n digits will tend to an answer. – Joe Nov 16 '24 at 02:05
  • If $n$ isn't fixed, from what distribution are you picking your numbers? – Randall Nov 16 '24 at 02:11
  • n is fixed, if n is 5 the the top number has 5 digits and the bottom one has 5-1. Is there a more formal way I can express this? – Joe Nov 16 '24 at 02:19
  • Whether $n$ is fixed or not, I can tell you that for speccific $n$-digit number $k$, let $S_k={(n+1)\text{-digit number}/k}$ then $n(S_k)=9\cdot10^n$ and the average of it is $0.5\cdot (11\cdot 10^{n+1}-1)/k$, with some calculation. Using Weighted Arithmetic Mean, you can get it easily. – RDK Nov 16 '24 at 03:00
  • What is the expected value you found? – Travis Willse Nov 16 '24 at 03:44
  • @traviswillse I originally expected the answer to be ten then my math shows 14.01 but my monte Carlo consistently showed 14.07 – Joe Nov 18 '24 at 20:58

1 Answers1

5

Assuming $n\geq 2$, the expected value of the given expression is equal to the sum $$ \sum_{k=10^{n-1}}^{10^n-1} \sum_{l=10^{n-2}}^{10^{n-1}-1} p_n p_{n-1} \frac{k}{l}, $$ where $p_n$ denotes the reciprocal value of the number of $n$-digit numbers. Using the formula for the sum of consecutive integers we get $$ p_n p_{n-1} \left[\frac{(10^n-1)10^n}{2} - \frac{(10^{n-1}-1)10^{n-1}}{2} \right] \times \left[ H(10^{n-1}-1) - H(10^{n-2}-1) \right], $$

where $H(m)$ denotes the $m$-th harmonic number. Since $H(m)$ is about as large as $\log m$ for large $m$, we can approximate the inside of the bracket on the right as $$ \log(10^{n-1}-1) - \log(10^{n-2}-1) = \log\frac{10^{n-1}-1}{10^{n-2}-1}, $$ which approximately equals $$ \log\frac{10^{n-1}}{10^{n-2}} = \log 10. $$ The average can thus be approximated by $$ p_{n-1} p_n \left[\frac{(10^n-1)10^n}{2} - \frac{(10^{n-1}-1)10^{n-1}}{2} \right] \times \log 10 = $$

$$ \frac{1}{2} \log 10 \frac{10^{n-1} (10^{n+1} - 10^{n-1} - 9)}{(10^n-10^{n-1}) (10^{n-1}-10^{n-2})} = $$ $$ \frac{1}{2} \log 10 \left[ \frac{110}{9} - \frac{1}{9 \cdot10^{n-2}} \right]. $$ As $n \rightarrow \infty$, this approaches the value $$ \frac{55}{9} \log 10 \approx 14.07. $$

Tim
  • 63
  • +1 to your answer. For what it's worth, I originally thought that your answer had to be wrong, because it disagreed with mine. Then, I realized that my answer had an analytical flaw, so I deleted my answer. – user2661923 Nov 16 '24 at 13:39
  • Just curious, was this answer your initial intuition? My initial intuition was 10, then my analysis showed 12.01, the monte Carlos showed your answer. Thank you for your help! – Joe Nov 18 '24 at 20:55
  • 1
    @Joe I actually did not even try to guess the answer and just went straight into calculation. But I did presume the answer was a bit different from ten since averages do not adhere to intuition when it comes to quotients of random variables, unlike they do with products. – Tim Nov 18 '24 at 23:09