I have two problems which are based on the sequence A007376.
- Natural numbers starting with 1 are written one after another like 123456789101112131415⋯, how could we find the 104th digit from left?
- A hundred digit number is formed by writing the first x natural numbers one after another
as 123456789101112131415⋯, 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?
Answer
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 1778th 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.
No comments:
Post a Comment