mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Rename Project Euler directories and other dependent changes (#3300)
* Rename all Project Euler directories: Reason: The change was done to maintain consistency throughout the directory and to keep all directories in sorted order. Due to the above change, some config files had to be modified: 'problem_22` -> `problem_022` * Update scripts to pad zeroes in PE directories
This commit is contained in:
37
project_euler/problem_052/sol1.py
Normal file
37
project_euler/problem_052/sol1.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""
|
||||
Permuted multiples
|
||||
Problem 52
|
||||
|
||||
It can be seen that the number, 125874, and its double, 251748, contain exactly
|
||||
the same digits, but in a different order.
|
||||
|
||||
Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x,
|
||||
contain the same digits.
|
||||
"""
|
||||
|
||||
|
||||
def solution():
|
||||
"""Returns the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and
|
||||
6x, contain the same digits.
|
||||
|
||||
>>> solution()
|
||||
142857
|
||||
"""
|
||||
i = 1
|
||||
|
||||
while True:
|
||||
if (
|
||||
sorted(list(str(i)))
|
||||
== sorted(list(str(2 * i)))
|
||||
== sorted(list(str(3 * i)))
|
||||
== sorted(list(str(4 * i)))
|
||||
== sorted(list(str(5 * i)))
|
||||
== sorted(list(str(6 * i)))
|
||||
):
|
||||
return i
|
||||
|
||||
i += 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(solution())
|
||||
Reference in New Issue
Block a user