Я подзабыл комбинаторику и мне требуется намек в каком направлении копать
tokens_qty == 1
+---+
| 0 | i = 1
+---+
tokens_qty == 2
+-------+
| 0 0 | i = 1
+---+---+
| 0 | 0 | i = 2
+---+---+
tokens_qty == 3
+-----------+
| 0 0 0 | i = 1
+-------+---+
| 0 0 | 0 | i = 2
+---+---+---+
| 0 | 0 0 | i = 2
+---+---+---+
| 0 | 0 | 0 | i = 3
+---+---+---+
tokens_qty == 4
+---------------+
| 0 0 0 0 | i = 1
+-----------+---+
| 0 0 0 | 0 | i = 2
+-------+---+---+
| 0 0 | 0 0 | i = 2
+---+---+-------+
| 0 | 0 0 0 | i = 2
+---+---+---+---+
| 0 0 | 0 | 0 | i = 3
+---+---+---+---+
| 0 | 0 0 | 0 | i = 3
+---+---+---+---+
| 0 | 0 | 0 0 | i = 3
+---+---+---+---+
| 0 | 0 | 0 | 0 | i = 4
+---+---+---+---+