summaryrefslogtreecommitdiff
path: root/052.py
diff options
context:
space:
mode:
Diffstat (limited to '052.py')
-rw-r--r--052.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/052.py b/052.py
new file mode 100644
index 0000000..2419a72
--- /dev/null
+++ b/052.py
@@ -0,0 +1,22 @@
+
+def digits(n):
+ result = [0]*10
+ while n > 0:
+ digit = n % 10
+ n /= 10
+ result[digit] += 1
+ return result
+
+def check(n):
+ foo = [ digits(n*x) for x in range(1, 7) ]
+ return foo == foo[1:]+foo[:1] # all array entries are equal
+
+n = 1
+
+while True:
+ if check(n):
+ break
+ n += 1
+
+print n
+