I came up with an algorithm finding the representation of a given number in the factorial number system. I have trouble proving its correctness in a formal way. Here is the