Project Euler/40/Solution
From charlesreid1
Main article: Project Euler/40
Solution
Here is a calculation of the product , where is the -th digit of the Champernowne constant .
We use the established method involving cumulative digit counts () for blocks of -digit numbers.
Finding the Digits
- Finding
The first digit () is the first digit of '1'.
- Finding
- . Falls into the 2-digit block (), since .
- Position within block: .
- Integer index (-based): .
- Integer .
- Digit position within (-based): . The 1st digit of 10.
- Finding
- . Falls into the 2-digit block (), since .
- Position within block: .
- Integer index: .
- Integer .
- Digit position: . The 1st digit of 55.
- Finding
- . Falls into the 3-digit block (), since .
- Position within block: .
- Integer index: .
- Integer .
- Digit position: . The 1st digit of 370.
- Finding
- . Falls into the 4-digit block (), since .
- Position within block: .
- Integer index: .
- Integer .
- Digit position: . The 3rd digit of 2777.
- Finding
- . Falls into the 5-digit block (), since .
- Position within block: .
- Integer index: .
- Integer .
- Digit position: . The 1st digit of 22222.
- Finding
- . Falls into the 6-digit block (), since .
- Position within block: .
- Integer index: .
- Integer .
- Digit position: . The 1st digit of 185185.
Calculating the Product
We need to compute the product :
The product of the specified digits is 210.
Flags