Adopted new convention from template
This commit is contained in:
parent
1b4f2f2fa6
commit
80bb7a94ed
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 23 Jun 2021
|
||||
|
||||
@ -15,29 +15,30 @@ from utils import timeit
|
||||
@timeit("Problem 40")
|
||||
def compute():
|
||||
"""
|
||||
An irrational decimal fraction is created by concatenating the positive integers:
|
||||
An irrational decimal fraction is created by concatenating the positive
|
||||
integers:
|
||||
|
||||
0.123456789101112131415161718192021...
|
||||
|
||||
It can be seen that the 12th digit of the fractional part is 1.
|
||||
|
||||
If d_n represents the n^th digit of the fractional part, find the value of the following expression.
|
||||
|
||||
d_1 × d_{10} × d_{100} × d_{1_000} × d_{10_000} × d_{100_000} × d_{1_000_000}
|
||||
If d_n represents the n^th digit of the fractional part, find the value of
|
||||
the following expression.
|
||||
|
||||
d_1 x d_{10} x d_{100} x d_{1_000} x d_{10_000} x d_{100_000}
|
||||
x d_{1_000_000}
|
||||
"""
|
||||
|
||||
fraction = ''
|
||||
fraction = ""
|
||||
for i in range(1, 1_000_000):
|
||||
fraction += str(i)
|
||||
|
||||
ans = 1
|
||||
for i in range(7):
|
||||
ans*= int(fraction[10**i - 1])
|
||||
ans *= int(fraction[10**i - 1])
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for Problem 40: {compute()}")
|
||||
print(f"Result for Problem 40 is {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user