1

We have the infinite sequence made from concatenation of consecutive natural numbers: $123456789101112131415\ldots$ There is also a function $f$, where $f(n)=k$ if the digit on the $10^n$'th position is from natural number with $k$ digits (so for example $f(1)=2$ because on the $10$'th position in the sequence there is $1$ from $10$, which is a 2-digit number.

The problem asks us to find $f(100005)$.

This is a problem from an exam from my discrete math class, yet I don't know which concept should I use. I only covered sums, binomial coefficients, generating functions, Stirling numbers and Inclusion-exclusion principle. I don't see however how any of these concepts are connected to this problem. Any hints?

qiubit
  • 2,313

2 Answers2

5

There are $9$ one digit numbers, which fill the first $9$ positions. There are $90$ two digit numbers, which fill the next $180$ positions. There are $900$ three digit numbers, which fill the next $2700$ positions. The position at the end of the $k$ digit numbers is $\sum_{i=1}^k9i10^i$ You need to sum this series and find the smallest $k$ such that the sum is greater than $10^{100005}$

Ross Millikan
  • 374,822
4

So, define $g(n)$ to be the number of digits of the number at the $n$th digit of this number.

You are looking for $f(n)=g(10^n)$.

$g(n)=k$ if and only if:

$$1+\sum_{i=1}^{k-1} i(10^{i}-10^{i-1})\leq n < 1+\sum_{i=1}^{k} i(10^i-10^{i-1})$$

So you need a closed form for $$m(k)=1+\sum_{i=1}^{k} i(10^i-10^{i-1})=1+9\sum_{i=1}^k i10^{i-1}$$

It can be shown that:

$$\sum_{i=1}^{k-1} iz^{i-1} = \frac{(k-1)z^k - kz^{k-1}+1}{(z-1)^2}$$

With $z=10$ this gives $$m(k)=\frac{1}{9}\left((k-1)10^k-k10^{k-1}+10\right)$$

Then you are trying to find the smallest $k$ so that $m(k)>10^{100005}$.

Definitely $k\approx 100000$. You'd have to try some values.

Thomas Andrews
  • 177,126
  • $(+1)$ But there are some typos: With your definition of $m(k)$, we have $g(n)=k$ iff $m(\color{blue}{k})\le n\lt m(\color{blue}{k+1})$, so we're trying to find the smallest $k$ such that $m(k\color{blue}{\mathbb{+1}})>n=10^{100005}$, which turns out to be $k=100001$ by computerized search. ($m(k)$ is the index of the first digit of the smallest $k$-digit natural number being concatenated, i.e., the index of the $1$ in $10^{k-1}$.) – r.e.s. Nov 01 '17 at 23:53