Moved problems till e045.py to Python 2.
This commit is contained in:
22
python/e040.py
Normal file
22
python/e040.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from lib_misc import product
|
||||
|
||||
|
||||
def get_irrational_fraction(digits_max):
|
||||
s = []
|
||||
n = 1
|
||||
digits = 0
|
||||
while digits < digits_max:
|
||||
s.append(str(n))
|
||||
digits += len(str(n))
|
||||
n += 1
|
||||
return "".join(s)
|
||||
|
||||
|
||||
def euler_040():
|
||||
f = get_irrational_fraction(1000001)
|
||||
return product(map(int, [f[10**i - 1] for i in range(7)]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("e040.py: " + str(euler_040()))
|
||||
assert(euler_040() == 210)
|
||||
Reference in New Issue
Block a user