Euler 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.
My Solution
def permuted_multiples(x):
def check_equal_multiples(x):
x_2 = str(2*x)
x_3 = str(3*x)
x_4 = str(4*x)
x_5 = str(5*x)
x_6 = str(6*x)
list_nums = [''.join(sorted(x_2)),''.join(sorted(x_3)),''.join(sorted(x_4)),''.join(sorted(x_5)),''.join(sorted(x_6))]
return len(set(list_nums))==1
while not check_equal_multiples(x):
x+=1
return x
permuted_multiples(x=1)
Answer: 142857