TITLE: How many distinct ways to climb stairs in 1 or 2 steps at a time?
QUESTION [23 upvotes]: I came across an interesting puzzle:

You are climbing a stair case. It takes $n$ steps to reach to the top.
  Each time you can either climb $1$ or $2$ steps. In how many distinct
  ways can you climb to the top?

Is there a closed-form solution to the problem? One can compute it by creating a 'tree' of possibilities of each step. That is, I can either take 1 or 2 steps at each stage and terminate a branch once it sums to $n$. But this is would get really unwieldy very quickly since the maximum number of nodes in a binary tree is $2^{n+1}-1$, i.e., exponential. Is there an easier way to solving this puzzle?

REPLY [2 votes]: We can change this question into: In how many ways is possible to write a number as the ordered sum of 1s and 2s?
We can prove this using direct proof.
Hypothesis: For Fibbonaci number $F_1=1, F_2=1, F_{n}=F_{n-1}+F_{n-2}$, $Q(k)=F_{k+1}$
We say that we have constructed every order of $Q(n)$. Then, we construct $Q(n+1)$ this way:

For all orders, we add $+1$ to change $n$ to $n+1$. (There are now $Q(n)$ numbers.) 
Note: all numbers that are constructed here ends in $+1$.
For all orders that end with $+1$, we change it to $+2$. We shall prove that the amount will be $Q(n-1)$ to complete the proof.
Note: all numbers that are constructed here ends in $+2$.

It can be seen that by constructing in this way there contains all orders.
Proof of step 2: If we constructed $Q(n)$ in the way above, then all numbers ended in $+1$ will be the amount $Q(n-1)$ by step 1. above, and we are done.