aboutsummaryrefslogtreecommitdiff
path: root/challenge-191/deadmarshal/python/ch2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-191/deadmarshal/python/ch2.py')
-rw-r--r--challenge-191/deadmarshal/python/ch2.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-191/deadmarshal/python/ch2.py b/challenge-191/deadmarshal/python/ch2.py
new file mode 100644
index 0000000000..30ac0b9f78
--- /dev/null
+++ b/challenge-191/deadmarshal/python/ch2.py
@@ -0,0 +1,15 @@
+from itertools import permutations
+
+def is_cute(arr):
+ for i in range(1,len(arr)+1):
+ if i % arr[i-1] != 0 and arr[i-1] % i != 0: return False
+ return True
+
+def cute_list(n):
+ arr = list(range(1,n+1))
+ count = 0
+ for perm in permutations(arr):
+ if is_cute(perm): count += 1
+ return count
+
+print(cute_list(2))