8

Basically, the question asks us to find the nth digit in the following sequence:

$$12345678910111213\dots9899100101\dots$$

where the 10th digit is $1$, the 11th digit is $0$, etc.

EDIT: Here are my workings: I was thinking about defining intervals in some way, for example, I know that there are 9 digits in this interval $0\dots9$ and $10\dots99$, and later try to find a sum. However, I am stuck on this point.

Micah
  • 38,108
  • 15
  • 85
  • 133
Artem
  • 1,208
  • Although it is OK to ask and answer your own question, I can't up-vote this, as you should at least show an effort to answer in the question. +1 for the answer though. – JMCF125 Jan 03 '14 at 19:19

1 Answers1

11

Consider a function $g(n)$, which is defined as: $$g(n)=\sum_{1\leqslant k \leqslant n} 9 \times 10^{k-1} \times k = \frac{ 9(n+1)10^n-10^{n+1}+1} {9} \qquad k,n \in \mathbb{Z^+}$$ You will probably see that the values can be calculated quite easily since there is a pattern: $$g(1)=9$$ $$g(2)=189$$ $$g(3)=2889$$ $$g(4)=38889$$ Now, given we want to find the $n$th digit we have to first solve $p$: $$ p=10^{\lceil a \rceil} -1 - \left\lfloor \frac{g( \lceil a \rceil) - g(a)}{\lceil a \rceil} \right\rfloor, g(a) = n \qquad a \in \mathbb{R^+}$$

This, $p$, will give us the number that contains the $n$th digit. So, in order to find the $n$th digit, calculate:

$$r = g(\lceil a \rceil ) - g(a) \mod \lceil a \rceil $$ The $r$ gives you the index of the $n$th digit in the number $p$.

$$p = (a_r\dots a_1a_0)$$

Reference: Los., Artem. (2014). Finding the nth digit in a sequence of positive integers placed in a row in ascending order.. Available: https://myows.com/protects/copyright/67407_mathexploration-pdf. Last accessed 3rd Jan 2014.

Artem
  • 1,208