Renamed all folders
This commit is contained in:
37
052/main.py
Normal file
37
052/main.py
Normal file
@@ -0,0 +1,37 @@
|
||||
'''
|
||||
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.
|
||||
'''
|
||||
|
||||
import time
|
||||
import math
|
||||
|
||||
def findMultiples(factors):
|
||||
result = 1
|
||||
|
||||
while True:
|
||||
products = [[s for s in str(f * result)] for f in factors]
|
||||
sresult = [s for s in str(result)]
|
||||
skip = False
|
||||
|
||||
for i in range(len(products) - 1):
|
||||
if len(products[i]) != len(sresult) or set(products[i]) != set(sresult):
|
||||
skip = True
|
||||
|
||||
if skip:
|
||||
result += 1
|
||||
continue
|
||||
|
||||
return result
|
||||
|
||||
def main():
|
||||
print("Hello, this is Patrick")
|
||||
|
||||
t0 = time.time()
|
||||
|
||||
print(findMultiples([2, 3, 4, 5, 6]), time.time() - t0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user