Long Legged Larry can climb 2, 3, or stairs at a time, where is the number of stairs he has climbed already ( ). For example, if he is on stair 7, he can climb up to the stairs 9, 10, or 14, but nothing in between. So, how many different ways can he climb exactly 20 stairs?
Clarification : For , climbing up 2 stairs and climbing up stairs is the same. i.e. There is only 1 way to climb up 4 stairs.
Image credit: rubygeiger.tumblr.com
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
For 1-6 stairs, you can quickly figure out that there are 0,1,1,1,2,2 ways respectively to get there. Now, to get to the n th stair, he must have come from either stair n − 2 , or n − 3 (or 2 n if n is even). So if f ( n ) is the number of ways he can climb to n stairs, then for n > 6 you can use this equation: f ( n ) = f ( n − 3 ) + f ( n − 2 ) for odd n , and f ( n ) = f ( n − 3 ) + f ( n − 2 ) + f ( n / 2 ) for even n . So, for n = 2 0 , f ( n ) = 1 7 4 .