Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a sequence of decimal digits $a_m=a_1 a_2 ... a_m$ and a random sequence of uniformely distributed decimal digits $a_n$, we want to estimate probability $P(a_m,n)$ such that $a_n$ contains $a_m$, i.e. '10012378' contains '123' and doesn't contain '101' or '345'.

Is it some well known problem? If it is hard to obtain general formula, may be there is a formula for specific sequence, e.g. sequence of ones.

So far we ended with following recursive formula for non-overlapping sequences ($a_m$ is such that $\forall k~ tail(a_m,k)\ne head(a_m,k)$): $$ P(a_m,n)= \left\{\begin{matrix} P(a_m,n-1)+(1-P(a_m,n-m))/10^m&n\ge m \\ 0&n<m \end{matrix}\right. $$ But it is hard to estimate formula for large $n$. If there is no explicit formula, what is $\lim_{m\rightarrow\infty}P(a_m,10^m)$? What is $n(m)$ such that $P(a_m, n)>0.9$?

share|cite|improve this question
up vote 2 down vote accepted

You will find that for your non-overlapping sequences $$P(a_m,n) \approx 1- \exp\left(-\frac{n}{\,10^m}\right)$$ so $\lim_{m\rightarrow\infty}P(a_m,10^m) = 1-e^{-1} \approx 0.632$ and $P(a_m, 10^m \log_e(10))\approx 0.9$

share|cite|improve this answer
Thank you! I still can't figure it out, but I've written small program to compare results and it seems to be correct :) – DikobrAz Feb 27 '13 at 10:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.