MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / solution

Function solution

project_euler/problem_052/sol1.py:13–33  ·  view source on GitHub ↗

Returns the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits. >>> solution() 142857

()

Source from the content-addressed store, hash-verified

11
12
13def solution():
14 """Returns the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and
15 6x, contain the same digits.
16
17 >>> solution()
18 142857
19 """
20 i = 1
21
22 while True:
23 if (
24 sorted(str(i))
25 == sorted(str(2 * i))
26 == sorted(str(3 * i))
27 == sorted(str(4 * i))
28 == sorted(str(5 * i))
29 == sorted(str(6 * i))
30 ):
31 return i
32
33 i += 1
34
35
36if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected