The Problem 40 of Project Euler required just a pencil and a paper to get the answer. We are given an irrational decimal fraction by concatenating consecutive integers:
0.123456789101112131415 …
The digit of this irrational number is 1 and is denoted as
. The problem requires us to determine the product:
x
x
x
x
x
x
A simple enumeration of digits and their positions works out easily.
To begin with, there are only 9 single digit numbers, namely, 1 – 9. So the first 9 places are occupied by single digit numbers. Next, there are 90 double digit numbers from 10 – 99. So these occupy a total of 180 places. We have now accounted for 189 places in out irrational number.
Determine the digits and
are as simple as illustrated below:
For :
Excess from last known digit position = 100 – 9 = 91
Numbers crossed in 91 positions = 91 / 2 = 45
Since the remainder is 1, we want the 1st digit of the 46th number from the one that appeared on position 9.
Thus the number we seek is 9 + 46 = 54, and the digit is therefore 5.
For :
Excess from last known digit position = 1000 – 189 =18 1
Numbers crossed in 811 positions = 811 / 3 = 270
Since the remainder is 1, we want the 1st digit of the 271st number from the one that appeared on position 189.
Thus the number we seek is 99 + 271 = 370, and the digit is therefore 3.
Repeating the same for all the digits we needed, the result is:
= 1
= 1
= 5
= 3
= 7
= 2
= 1
Thus the product is 210
Popularity: 8% [?]
Related posts:
