# Code Golf - Print all unique ways of writing a number as a sum with a lexical order [duplicate]

I found about Code Golf after writing this program and decided to post the rules here so you can try it out too. I saw this, which is a less restrictive version of my question. I've got a bit more rules which (in my opinion) make the task quite a lot more tougher.

Title says it all. If the input is 8, we should get:

8 = 8
8 = 7 + 1
8 = 6 + 2
8 = 6 + 1 + 1
8 = 5 + 3
8 = 5 + 2 + 1
8 = 5 + 1 + 1 + 1
8 = 4 + 4
8 = 4 + 3 + 1
8 = 4 + 2 + 2
8 = 4 + 2 + 1 + 1
8 = 4 + 1 + 1 + 1 + 1
8 = 3 + 3 + 2
8 = 3 + 3 + 1 + 1
8 = 3 + 2 + 2 + 1
8 = 3 + 2 + 1 + 1 + 1
8 = 3 + 1 + 1 + 1 + 1 + 1
8 = 2 + 2 + 2 + 2
8 = 2 + 2 + 2 + 1 + 1
8 = 2 + 2 + 1 + 1 + 1 + 1
8 = 2 + 1 + 1 + 1 + 1 + 1 + 1
8 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1


Unique means this 7 + 1 and this 1 + 7 is not allowed.

Lexical order means members must be sorted in descending order by the first addend. If their first addend is equal, sort them by their second addend, etc.

## Objective

Lowest size program wins.

I'll post my solution after a few days or after a few of you have posted yours. Have fun!

• I assume this is code-golf, but you should explicitly state the winning objective somewhere in the post - otherwise, nice challenge. Jan 16 '17 at 18:22
• We've had a bunch of challenges about partitions already. It's probably not a duplicate of this challenge. It might be too similar to this one though.
– user62131
Jan 16 '17 at 18:24
• Is any leading/trailing whitespace allowed? Jan 16 '17 at 18:29
• Welcome to PPCG! This is a nice first challenge, but unfortunately, we've done it before. For the future, I recommend posting challenge ideas in the sandbox to get some feedback before the challenge goes live. Apart from having help looking for duplicates, you can also get feedback about other potential problems with the challenge that can be fixed before anyone starts working on or even posting answers. Jan 16 '17 at 18:31
• @BusinessCat depends on whether people think my challenge is valid or a duplicate. Jan 16 '17 at 18:48