This is from a closed question: What is the $n$th digit of this sequence?: What's the $n$th digit of the sequence where all natural numbers are repeated the time equal to itself:
$$122333\cdots1010101010101010101011\cdots$$
My results so far: First we compute how many digits are there from $10^{k-1}$ to $10^k-1, \forall k=1, 2, \ldots$
$$ a_k = k(10^{k-1} + \cdots + (10^k-1))=k\frac{10^{k-1}+10^k-1}{2} \cdot (9\cdot 10^{k-1}) $$
Then we compute the partial sum (define $S_0=0$) $$ S_m=\sum_{k=1}^m a_k = \sum_{k=0}^m \frac{9k}{2} \left(10^{2k-1}+10^{2k-2}-10^{k-1} \right)\\ =\frac{1}{198}(10^m-1)(99m \cdot 10^m - 10^m+10)$$ $$=5(10^m-1)\left(m\cdot 10^{m-1}-\frac{10^{m-1}-1}{10^2-1}\right)\tag 1 $$
I admit I cheated with WA.
For any $n \in \mathbb N$ we need to find $m$ such that $S_{m-1} < n \le S_m$, then we'd know the digit we are looking for is $$\text{the } \left(m- ((S_{m-1}-n) \pmod m ) \right)^{th} \text{ digit of the (} m \text{-digit number) }10^{m-1}-1 + \lceil \frac{n-S_{m-1}}{m}\rceil \tag 2$$
My questions:
a) Any single formula to get the digit in terms of $n$? I doubt there is one because getting $m$ out of $S_m$ from $(1)$ looks difficult but who knows.
b) If a) is not possible, any better alternative to $(2)$ given $m$?
My math is off there I think but this program holds up for single digit and 10, 11
https://dotnetfiddle.net/rdtKBE
The justification is that there will always be D - 1 digits before any digital until D approaches 0.
– Jay Dec 16 '20 at 04:40