Note that my i goes downwards, from N to 1. Because position i = 1 can hold any number, so I don't even have to check whether the last remaining number fits there. Also, position i = 2 happily holds every second number and i = 3 happily holds every third number, so filling the lowest positions last has a relatively high chance of success. In other words, it's relatively hard to end up with dead ends this way.

No, I don't like this solution, since we can always find a way to cheat. lol

I mean you can do memorisation, your recursive call is repeating the same task, such as when N = 6, you are recomputing
i = 3, X = (3, 4, 6)
i = 2, X = (4, 6)
...
When N become bigger, the cost could be quit big.