Winnable Solitaire Mancala Boards Mancala is the name of a family of board games that usually involve a series of cups filled with beads that the players manipulate. This challenge will use a specific rule set for a solitaire variant of the game.

The board consists of a "basket" at one end, followed by an infinite number of cups, numbered starting from 1. Some of the cups will have some number of beads in them. If the nth cup has exactly n beads in it, you may "sow" the beads from it. Sowing means to take all n beads out of the cup, then deposit them one at a time in each cup towards the basket. The last bead will go into the basket. The player wins when all of the beads on the board are in the basket.

Clearly, there are many boards which are not winnable, such as if there is exactly one bead in the second cup. There are no legal plays because all the cups with 0 beads cannot be sown, and the second cup does not have enough beads to be sown. This is obviously no fun, so your task will be to create winnable boards.

Task

Given a positive integer representing a number of beads output a list of non-negative integers representing the number of beads that should be put in each cup to make a winnable board as described above. This list should not contain any trailing zeroes.

For any given number of beads, there is always exactly one winnable board configuration.

Demonstration

This is a demonstration of how to play the winnable board for and input of 4. The winnable board is [0, 1, 3]. We start with the only available move, sowing the beads from the third cup to get [1, 2, 0]. Now we actually have a choice, but the only correct one is sowing the first cup, getting: [0, 2, 0]. Then we sow the second cup yielding [1, 0, 0] and finally we sow the first cup again to get all empty cups.

Test cases:

1 =&gt; [1]
2 =&gt; [0, 2]
3 =&gt; [1, 2]
4 =&gt; [0, 1, 3]
5 =&gt; [1, 1, 3]
6 =&gt; [0, 0, 2, 4]
7 =&gt; [1, 0, 2, 4]
8 =&gt; [0, 2, 2, 4]
9 =&gt; [1, 2, 2, 4]
10 =&gt; [0, 1, 1, 3, 5]
11 =&gt; [1, 1, 1, 3, 5]
12 =&gt; [0, 0, 0, 2, 4, 6]
13 =&gt; [1, 0, 0, 2, 4, 6]
14 =&gt; [0, 2, 0, 2, 4, 6]
15 =&gt; [1, 2, 0, 2, 4, 6]
16 =&gt; [0, 1, 3, 2, 4, 6]
17 =&gt; [1, 1, 3, 2, 4, 6]
18 =&gt; [0, 0, 2, 1, 3, 5, 7]
19 =&gt; [1, 0, 2, 1, 3, 5, 7]
20 =&gt; [0, 2, 2, 1, 3, 5, 7]


Big thanks to PeterTaylor for coming up with a program to generate test cases!
Python, 42 41 bytes

m=lambda n,i=2:n*[1]and[n%i]+m(n-n%i,i+1)