Explorar o código

Added solution to problem 52.

Taddeus Kroes %!s(int64=14) %!d(string=hai) anos
pai
achega
67c40e5a28
Modificáronse 1 ficheiros con 19 adicións e 0 borrados
  1. 19 0
      problem52.py

+ 19 - 0
problem52.py

@@ -0,0 +1,19 @@
+#!/usr/bin/python
+def digits(n):
+    return set(list(str(n)))
+
+x = 1
+
+while True:
+    found = True
+    d = digits(x)
+
+    for i in range(2, 7):
+        if digits(i * x) != d:
+            found = False
+
+    if found:
+        print x
+        break
+
+    x += 1