aboutsummaryrefslogtreecommitdiff
path: root/python/helper/other.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/helper/other.py')
-rw-r--r--python/helper/other.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/python/helper/other.py b/python/helper/other.py
new file mode 100644
index 0000000..05854d8
--- /dev/null
+++ b/python/helper/other.py
@@ -0,0 +1,8 @@
+from itertools import permutations
+
+
+def n_digits_pandigital(n, front_zero=False):
+ return [
+ int(''.join(map(lambda n: str(n), x)))
+ for x in permutations(range(n)) if front_zero or x[0] != 0
+ ]