Skip to content

Commit

Permalink
add euler043 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
kailanefelix committed Nov 28, 2021
1 parent f98944a commit e255a85
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions euler0XX/euler043.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from itertools import permutations

primes = [2, 3, 5, 7, 11, 13, 17]

total = 0
for n in permutations('0123456789'):
for i, prime in enumerate(primes):
number = ''.join(n[i+1:i+4])
if int(number) % prime != 0:
break

else:
total = total + int(''.join(n))

print(total)

0 comments on commit e255a85

Please sign in to comment.