## On the Subject of Digisibility

Not as random as it seems...

The module shows two displays and nine numbered buttons. To solve the module, input the correct sequence.

The buttons in reading order give a nine-digit number. Rearrange this number so that for each n, the number made of the first n digits of this rearrangement is divisible by the number at position n in the original number.

### Example

For this example we'll be using 123456789.

Let's assume our number is written as ABCDEFGHI, containing all of the digits of 123456789 as many times as they occur in this number, so once for each. Since ABCDE must be divisible by 5, E must be equal to 5 as 0 is not available. Our new number can be noted as ABCD5FGHI. All even numbers must be on the positions of even divisibility to not break the even divisibilities, and all odd numbers can therefore only be placed in odd positions. Since the digital root of the sequence is 9, position I will always be satisfied. So will A, as any integer is divisible by 1.

Since any number is divisible by three if its digital root is, ABC must sum to a multiple of 3. So must DEF, since ABC will cancel itself out. Let's look at DEF first. A number is divisible by 4 if the last digit divided by 2 has the same odd/even parity as the number before it (not dividing by 2), given that the last digit is even. Since the digit before it must be odd, D can only be 2 or 6. This all together makes DEF be either 258 or 654

Now let's look at ABC. There's more freedom on this part, but due to defining DEF, it's reduced. If DEF is 258, ABC can be 147, 369, 741 and 963. If DEF is 654, ABC can be 123, 129, 183, 189, 321, 327, 381, 387, 723, 729, 783, 789, 921, 927, 981 or 987. Checking for divisibility by 7 can be done by multiplying every ABCDEF by 10 and seeing what can be added to it to make it a multiple of 7. This results in 7 valid combinations: 1296547, 1472583, 3216549, 3816547, 7296541, 7836549, 9216543. After checking what remains valid when appending the final even digit the only number can be 38165472. Finally we can add the remaining odd digit to it, which has already been proven valid. The result is the number 381654729.