Adopted new convention from template
This commit is contained in:
parent
9934dd3d38
commit
0d15cfab5d
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 03 Aug 2021
|
||||
|
||||
@ -10,14 +10,15 @@ https://projecteuler.net/problem=43
|
||||
"""
|
||||
|
||||
from itertools import permutations
|
||||
|
||||
from utils import timeit
|
||||
|
||||
|
||||
@timeit("Problem 43")
|
||||
def compute():
|
||||
"""
|
||||
The number, 1406357289, is a 0 to 9 pandigital number because
|
||||
it is made up of each of the digits 0 to 9 in some order, but
|
||||
The number, 1406357289, is a 0 to 9 pandigital number because
|
||||
it is made up of each of the digits 0 to 9 in some order, but
|
||||
it also has a rather interesting sub-string divisibility property.
|
||||
|
||||
Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this
|
||||
@ -34,7 +35,7 @@ def compute():
|
||||
Find the sum of all 0 to 9 pandigital numbers with this property.
|
||||
"""
|
||||
ans = []
|
||||
pandigital = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||
pandigital = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||
|
||||
for n in permutations(pandigital):
|
||||
n_ = "".join(n)
|
||||
@ -50,6 +51,6 @@ def compute():
|
||||
|
||||
return sum(ans)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for Problem 43: {compute()}")
|
||||
if __name__ == "__main__":
|
||||
print(f"Result for Problem 43 is {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user