Calculating a Factorial Base Representation

Use the standard base conversion algorithm, using the fact that the digit weights are not powers of a base but factorials:

$$d_1=n \text{ mod }2, n_1= n \text{ div } 2,$$ $$d_2=n_1 \text{ mod }3, n_2= n_1 \text{ div } 3,$$ $$d_3=n_2 \text{ mod }4, n_3= n_2 \text{ div } 4$$ $$...$$

This is just an inversion of the "Horner" form $n = d_1 + 2(d_2+3(d_3+4(d_4...+ld_l)))$. In the standard case, the increasing integers would be replaced by the base.

w= 2
while N != 0:
    print N % w,
    N/= w
    w+= 1