Project Euler #52: Permuted multiples

  • + 0 comments

    100 points/- python3

    item=input().split()
    n,k=int(item[0]),int(item[1])
    
    def ispermuted(n,n_):
        n=str(n)
        n_=str(n_)
        if sorted(n)==sorted(n_):
            return True
        else:
            return False
    
    for i in range(1,n+1):
        if all([ispermuted(i,i*j) for j in range(2,k+1)]):
            print(*[i*j for j in range(1,k+1)])