Escape from Prison - Puzzle

A prisoner is trying to escape from a prison, and the only way out is through a 100-step staircase. Each night, the prisoner can climb up either 1 step or 2 steps. However, there’s a twist: a policeman is waiting at the top of the staircase. The policeman will only catch the prisoner if the prisoner reaches exactly the 100th step. The prisoner needs to determine the number of different ways to reach the 100th step without being caught by the policeman.

Objective:
Calculate the number of ways the prisoner can escape without being caught, meaning the prisoner should not land exactly on the 100th step.

Solution

This puzzle can be solved by first calculating the total number of ways the prisoner can reach the 100th step and then subtracting the paths that end exactly on the 100th step.

Step-by-Step Solution for Prisoner and Policemen Puzzle:

Step 1: Calculate the Total Ways to Reach the 100th Step

The prisoner has two options at each step: either take a 1-step move or a 2-step move. The problem can be likened to the Fibonacci sequence because the number of ways to reach a particular step is the sum of the ways to reach the previous two steps.

  • Let f(n) represent the number of ways to reach the n-th step.

  • The recurrence relation is:
    f(n)=f(n−1)+f(n−2)

  • With initial conditions:

    • f(1)=1(only one way to reach the first step)
    • f(2)=2 (two ways: one step twice or a single 2-step move)

Using this recurrence relation, calculate f(100), which represents the total number of ways to reach the 100th step.

Step 2: Subtract the Paths That End Exactly on the 100th Step

Since the prisoner cannot land on the 100th step, we need to subtract the number of ways that lead to the 100th step.

The prisoner must stop at the 99th step and take a 1-step move to the 100th step, or stop at the 98th step and take a 2-step move to the 100th step. The total number of paths that end exactly on the 100th step is:

  • f(99) (paths that reach the 99th step) + f(98)(paths that reach the 98th step)

Step 3: Calculate the Final Answer

The number of ways the prisoner can avoid being caught is the total number of ways to reach the 100th step minus the paths that end exactly on the 100th step:

  • Valid paths=f(100)−(f(99)+f(98))

This result will give the number of different ways the prisoner can escape without landing on the 100th step and being caught by the policeman.

Final Answer

By following the above steps, the number of ways the prisoner can escape without getting caught is f(100)−(f(99)+f(98)), where f(n) is derived using the Fibonacci-like recurrence relation.

tools

Puzzles

Related Articles