-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathsolution_1.py
More file actions
37 lines (29 loc) · 828 Bytes
/
solution_1.py
File metadata and controls
37 lines (29 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
# coding=utf-8
# Python Script
#
# Copyleft © Manoel Vilela
#
#
from functools import reduce
from itertools import count
def frac_series_generator():
'''each n after 0.1 from 0.12345678910111213...'''
for w in count(start=1, step=1):
for s in str(w):
yield s
def search_digit_by_index(indexes):
'''get the digits of indexes of frac_series'''
limit = max(indexes)
digits = {x: 0 for x in indexes}
for c, n in enumerate(frac_series_generator()):
if c + 1 in digits:
digits[c + 1] = int(n)
if c + 1 >= limit:
break
return digits.values()
def main():
indexes = [1, 10, 100, 1000, 10000, 100000, 1000000]
print(reduce(int.__mul__, search_digit_by_index(indexes)))
if __name__ == '__main__':
main()