Monday puzzle: elevator buttons malfunctioning (spoilers)
An elevator in my office building of 65 floors is malfunctioning.
Whenever someone wants to go up, the elevator moves up by 8 floors if it can. If the elevator cannot move up by 8 floors, it stays in the same spot (if you are on floor 63 and press up, the elevator stays on floor 63).
And whenever someone wants to go down, the elevator moves down by 11 floors if it can. If it cannot, then the elevator stays in the same spot. (if you press down from floor 9, the elevator stays on floor 9).
The elevator starts on floor 1. Is it possible to reach every floor in the building?
How many times would you have to stop to reach the 60th floor, if you started on floor 1?
The solution is below.
(This puzzle is adapted from here)
Answer
It is possible to reach every floor in the building.
I used a spreadsheet to illustrate exactly how this is possible.
On the table below, every floor can be reached by a combination of moving up by 8 floors and moving down by 11 floors. (For simplicity, we can imagine the elevator has an “UP” button and a “DOWN” button).
The horizontal rows show an elevator moving up by 8 floors at a time, and the vertical columns are when the elevator moves down by 11 floors at a time.
(click on table for larger image)
You can see that every floor is attainable.
The harder part is to see why this actually works.
The reason has to do with number theory. We are essentially looking for integers solutions to the following equation:
8 x – 11 y = floor number
These types of equations are known as linear Diophantine equations. For a general equation, ax + by = c, solutions exist if and only if c is a multiple of the greatest common divisor of a and b.
In our case, 8 and 11 are relatively prime and have a greatest common divisor of 1, thus there are infinitely many solutions to the equation. The tricky part is verifying that every floor can be reached without going above floor 65 or going below floor 1, which is what the table above demonstrates.
How many times would you have to stop to reach the 60th floor, if you started on floor 1?
I got the idea for this question when I noticed floor 60 is the farthest away from floor 1 in the table.
I believe (but have not proved) the quickest route to get to floor 60 is to take 24 stops along the way: go across the first row, then move down in a step ladder fashion until you reach the bottom row of the table, and then move across the last row.
The floor sequence is: 1, 9, 17, 25, 33, 41, 49, 57, 65, 54, 43, 32, 21, 10, 18, 7, 15, 4, 12, 20, 28, 36, 44, 52, and finally 60.
That’s a long way to ride to get to your floor–that floor better hope someone fixes the elevator quickly!
Share this post:
Previous post: A trick to getting more booze in bars
Next post: When game theory backfires: a case study of Robert Campeau’s takeover bid






