Initial release
This commit is contained in:
16
Produit et somme palindromiques.py
Normal file
16
Produit et somme palindromiques.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from itertools import product, combinations
|
||||
|
||||
mini = 12
|
||||
maxi = 82
|
||||
|
||||
table_i = (i for i in range(mini, maxi+1))
|
||||
|
||||
table = list(product(table_i, repeat=4))
|
||||
|
||||
solution = list()
|
||||
for item in table:
|
||||
if str(item[0]+item[1]+item[2]+item[3]) == str(item[0]+item[1]+item[2]+item[3])[::-1] and str(item[0]*item[1]*item[2]*item[3]) == str(item[0]*item[1]*item[2]*item[3])[::-1]:
|
||||
if sorted(item) not in solution:
|
||||
solution.append(sorted(item))
|
||||
|
||||
print(len(solution))
|
||||
Reference in New Issue
Block a user