Project Euler/40/Solution
From charlesreid1
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 Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle C_{1}<100\leq C_{2}} .
- 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 Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle N=10^{4-1}+1777=1000+1777=2777} .
- Digit position: Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle digit\_pos=(7111-1){\pmod {4}}+1=7110{\pmod {4}}+1=2+1=3} . The 3rd digit of 2777.
- Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle d_{10000}=7}
- Finding Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle d_{100000}}
- . Falls into the 5-digit block (Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle k=5} ), since Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle C_{4}<100000\leq C_{5}} .
- Position within block: Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle m=100000-C_{4}=100000-38889=61111} .
- Integer index: Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle num\_index=\lfloor (61111-1)/5\rfloor =\lfloor 61110/5\rfloor =12222} .
- Integer Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle N=10^{5-1}+12222=10000+12222=22222} .
- Digit position: Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle digit\_pos=(61111-1){\pmod {5}}+1=61110{\pmod {5}}+1=0+1=1} . The 1st digit of 22222.
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle d_{100000} = 2}
- Finding Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle d_{1000000}}
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle n=1000000} . Falls into the 6-digit block (Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle k=6} ), since Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle C_5 < 1000000 \le C_6} .
- Position within block: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle m = 1000000 - C_5 = 1000000 - 488889 = 511111} .
- Integer index: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle num\_index = \lfloor (511111 - 1) / 6 \rfloor = \lfloor 511110 / 6 \rfloor = 85185} .
- Integer Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle N = 10^{6-1} + 85185 = 100000 + 85185 = 185185} .
- Digit position: Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle digit\_pos = (511111 - 1) \pmod 6 + 1 = 511110 \pmod 6 + 1 = 0 + 1 = 1} . The 1st digit of 185185.
- Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle d_{1000000} = 1}
Calculating the Product
We need to compute the product Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle P} :
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle P = d_1 \times d_{10} \times d_{100} \times d_{1000} \times d_{10000} \times d_{100000} \times d_{1000000}}
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle P = 1 \times 1 \times 5 \times 3 \times 7 \times 2 \times 1}
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle P = 105 \times 2}
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle P = 210}
The product of the specified digits is 210.
Flags