How to find the, say, 28383rd term of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0, 1, 1, 1, 2,.... ?
EDIT: The sequence is the sequence of digits of positive integers in order.
thanks,
How to find the, say, 28383rd term of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0, 1, 1, 1, 2,.... ?
EDIT: The sequence is the sequence of digits of positive integers in order.
thanks,
There is a formula that can be used to compute this based on the sum:
$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^+}$
Plug it in to:
$ 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^+}$
And now find $r$
$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$.
and get the digit from: $p = (a_r\dots a_1a_0)$
Read more here: Find the $n^{\rm th}$ digit in the sequence $123456789101112\dots$
Just to complement Ross Millikan's answer, notice that using digits of your sequence as decimal fractional digits produces a number, known as Champernowne constant.
For verification purposes you could use Mathematica:
In[130]:= RealDigits[ChampernowneNumber[], 10, 1, -28383] Out[130]= {{3}, -28382}
Hint: think about how many terms are produced by the 1 digit numbers, then how many terms are produced by the 2 digit numbers, etc. That will allow you to get that you are in the $m$ digit numbers and the end of the $m-1$ digit numbers is $p$. So now you want the $28383-p$ term of the $m$ digit numbers, and each one contributes $m$ terms.