Problem 52 : Permuted multiples

Problem Statement

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.

Solution

chk=True
while chk:
    for num in range(100,10**6):
        coun=0
        for i in range(2,7):
            val=i*num
            num_str = sorted(list(str(num)))
            val_str = sorted(list(str(val)))

            if num_str == val_str:
                coun+=1
        if coun == 5:
            print(num)
            chk=False

Output

142857