Amanda has a strange condition where she can climb only a prime number of stairs at a time. How many different ways can she climb up exactly 30 stairs?
For example, three possibilities are:
Photo credit: http://khabar.ibnlive.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.
If X n is the number of ways of climbing n steps, then the equations X 0 = 1 X 1 = 0 X n = p ≤ n ∑ X n − p determine the sequence X n , where the symbol p denotes that we are summing over primes p less than or equal to n .
The formula
X[n_] := Total[X[n - #] & /@ Table[Prime[r], {r, 1, PrimePi[n]}]]
together with X [ 0 ] = 1 and X [ 1 ] = 0 in Mathematica can be used to yield the following list of the first 3 1 values X 0 , X 1 , … , X 3 0 :
{ 1 , 0 , 1 , 1 , 1 , 3 , 2 , 6 , 6 , 1 0 , 1 6 , 2 0 , 3 5 , 4 6 , 7 2 , 1 0 5 , 1 5 2 , 2 3 2 , 3 3 2 , 5 0 1 , 7 3 2 , 1 0 8 1 , 1 6 0 4 , 2 3 5 2 , 3 4 9 3 , 5 1 3 6 , 7 5 9 5 , 1 1 2 1 2 , 1 6 5 3 4 , 2 4 4 4 2 , 3 6 0 3 9 }
The answer is 3 6 0 3 9 .
The solution can be found as follows...
If f ( n ) is the number of ways she can climb up n stairs, then it is easy to see that the first few number of ways are: f ( 1 ) = 0 , f ( 2 ) = 1 , f ( 3 ) = 1 , f ( 4 ) = 1 , f ( 5 ) = 3 . For higher values of n you can use the following formula: f ( n ) = f ( n − 2 ) + f ( n − 3 ) + f ( n − 5 ) + . . . where you keep subtracting primes until you get to a number less than one (and stop just before you get to it). This is because on the n th stair she must have come from one of the stairs n − p where p is a prime number
From this, you can determine that f ( 3 0 ) = 3 6 0 3 9
Problem Loading...
Note Loading...
Set Loading...
A solution can be: k = 2 ∑ 1 5 C o e f f i c i e n t [ ( x 2 3 + x 1 9 + x 1 7 + x 1 3 + x 1 1 + x 7 + x 5 + x 3 + x 2 ) k , x 3 0 ] = 3 6 0 3 9