aboutsummaryrefslogtreecommitdiff
path: root/tools/coin.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/coin.py')
-rwxr-xr-xtools/coin.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/coin.py b/tools/coin.py
new file mode 100755
index 0000000..fdf7e5c
--- /dev/null
+++ b/tools/coin.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+from itertools import permutations
+
+
+def check_resution(arr):
+ a, b, c, d, e = arr
+ return a + b * c**2 + d**3 - e == 399
+
+
+if __name__ == "__main__":
+ coins = {2: "red", 3: "corroded", 5: "shiny", 7: "concave", 9: "blue"}
+ res = next(i for i in permutations(coins.keys(), len(coins)) if check_resution(i))
+ print("order: " + ", ".join([coins[i] for i in res]))
+ print("({} + {}*{}^2 + {}^3 - {} = 399)".format(*res))