У меня есть числа от 0 до 8. Я хотел бы, в результате, все возможные наборы этих чисел, каждый набор должен использовать все числа, каждый номер может встречаться только один раз в наборе.
Я хотел бы увидеть решение, сделанное на PHP, которое может распечатать результат. Или, по крайней мере, я хотел бы немного осведомиться в теории комбинаторики, о чем я давно забыл. Какова формула для вычисления количества перестановок?
Примеры:
- 0-1-2-3-4-5-6-7-8
- 0-1-2-3-4-5-6-8-7
- 0-1-2-3-4-5-8-6-7
- 0-1-2-3-4-8-5-6-7
- 0-1-2-3-8-4-5-6-7
- 0-1-2-8-3-4-5-6-7
- и т.д.