37 lines
905 B
Python
37 lines
905 B
Python
'''
|
|
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() |