This feels like a very simple problem, but I can't manage to make it elegant and 'feels right'. Here's the problem:
Giving a number T, print out all possible ways to get to T. For example :
T = 5
1 + 1 + 1 +1 + 1
2 + 1 + 1 + 1
3 + 1 + 1
2 + 2 + 1
4 + 1
3 + 2
Note that, 3 + 2 is equal than 2 + 3, so you don´t have to print both cases.
I have to do it in PHP, hope anyone can help :).