TITLE: Ordered partitions of positive integer N
QUESTION [5 upvotes]: What is number of ordered partitions of a positive integer $N$?
I see that 
1 = 1,

2 = 2, 1+1,

3 = 3, 2+1, 1+2, 1+1+1,

4 = 4, 3+1, 1+3, 2+2, 2+1+1, 1+2+1, 1+1+2, 1+1+1+1,

So far we observe that that $N$ has $2^{N-1}$ ordered partition.
I tried to prove the result with induction but could not proceed with the inductive hypothesis.Any help would be appreciated.

REPLY [6 votes]: These are called compositions and there are $2^{N - 1}$ of them for $N$. To see this note that a composition is the same thing as choosing a way to put bars in between stars:
e.g. 1 + 3 + 2 + 1 corresponds to * | * * * | * * | *
There are $N - 1$ gaps and you are selecting a subset of these. Thus there are
$$ {N - 1 \choose k - 1}$$
compositions of $N$ with $k$ parts and
$$ 2^{N - 1} $$
compositions of $N$ with any number of parts.

The inductive argument:
You can either put a $+ 1$ at the end or merge the $1$ into the last part. Then argue that every composition of $N$ is obtained in exactly one of these ways (i.e. given a composition of $N$, figure out whether it came from adding $1$ or merging $1$). So you have two inclusions $$ \{\text{compositions of } N - 1\} \longrightarrow \{\text{compositions of } N \} $$ whose images are disjoint but their union is everything (can you see how this follows?). Therefore there are twice as many compositions of $N$ as there are $N - 1$.