Ad

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.

function lowestPermutedMultiple(n) {
    let base = n;
    let numDigits = n.toString().length;
    let i = 1;
    let solution = i;
    while ((n * i).toString().length <= numDigits) {
        if (base.toString().split('').sort().join('') == (n*i).toString().split('').sort().join('')) {
            solution = i;
        }
        i++;
    }
    return solution;
}