Friday, March 18, 2016

elementary number theory - 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?


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 $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.


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...