# Which is the fastest way to solve these two problem?

I have two problems which are based on the sequence $A007376$.

1. Natural numbers starting with $1$ are written one after another like $123456789101112131415\cdots$, how could we find the $10^4$th digit from left?
2. A hundred digit number is formed by writing the first $x$ natural numbers one after another as $123456789101112131415\cdots$, how to find the remainder when this number is divided by $8$?

The OEIS doesn't provide any formula that could be implemented into a under a minute solution,as this is a quantitative aptitude problem, I was wondering which is the fastest way to approach?

-

There are $9$ one-digit numbers, giving the first $9$ digits.
Then there are $90$ two-digit numbers, giving the next $180$ digits; total, $189$ digits, so far.
There are $900$ three-digit numbers, giving $2700$ digits, total $2889$.
To get to $10,000$, you need another $7111$, which is $7108/4=1777$ four-digit numbers, and the first $3$ digits of the $1778$th four-digit number. You should be able to figure out what those are.
For the hundred digit number, same process, then remember that the remainder on division by $8$ depends only on the last $3$ digits.
@MaX Just for the sake of completeness, $12345\cdots545= 12345\cdots\times 100 + 545$ and so $12345\cdots545\mod 8 = (12345\cdots\mod 8)\times (100\mod 8) + (545\mod 8) \mod 8 = 545\mod 8$ since $100\mod 8 = 0\mod 8$. – Alex Becker Dec 29 '11 at 4:41