<reponame>mohenjo/AlgorithmTraining
"""Permuted multiples

http://www.rosettacode.org/wiki/Permuted_multiples
"""


def isok(num: int, seqlen: int) -> bool:
    pool: list[int] = [num * i for i in range(1, seqlen + 1)]
    # check if all items are of diffrent order
    isalldifforder: bool = len(set(pool)) == seqlen
    # check if all items contain exactly the same digits
    # itoa => sort each => atoi => make set => len = 1 if all numbers have same digits
    isallpermutated: bool = len(set(int("".join(sorted(str(i)))) for i in pool)) == 1
    return isalldifforder and isallpermutated


def main():
    seqlen: int = 6
    chknum: int = 1
    while not isok(chknum, seqlen):
        chknum += 1
    print(f"n = {chknum}")


if __name__ == "__main__":
    main()
