Expansion into terms
Problem
It is required to display all different representations of a natural number N
as a sum of natural numbers. Representations that differ from each other in the order of terms are not different.
Input
The input string contains an integer N
(2 ≤ N ≤ 40).
Output
In your answer, output all different representations of the number
N
without repetitions as a sum one at a time on a separate line. Both the terms and the sums themselves can follow in any order.
Examples
# |
Input |
Output |
1 |
4 |
|
2 |
5 |
1 1 1 1 1
1 1 1 2
1 1 3
1 2 2
2 3
1 4
5
|