This was a difficult puzzle. I got the correct answer only from Suman Saraf, and another correct answer to a slightly modified puzzle from Pratik Poddar.
You can measure 23 different lengths. Here’s an explanation, taken from the site fivethrityeight.com.
The first trick is realizing that you can record 30 minutes by burning both ends of one rope. Since you know it takes an hour to burn through a rope from one end to the other, once the two burns meet you know each will have burned through 30 minutes of rope (even though they might not meet at the center of the rope thanks to the non-constant burn rates). You also have to consider burning the ends of the ropes at different times. For example, to measure 45 minutes, you can burn both ends of the first rope and one end of the second rope. After 30 minutes have passed, you can burn the other end of the second rope, making 45 minutes.
The calculation gets very tricky as we add ropes. Below are the possible lengths of time (in minutes, not including zero):
One rope: 30 and 60
Two ropes: 30, 45, 60, 90 and 120
Three ropes: 30, 45, 52.5, 60, 67.5, 75, 90, 105, 120, 150 and 180
Four ropes: 30, 45, 52.5, 56.5, 60, 67.5, 71.25, 75, 78.75, 82.5, 86.25, 90, 97.5, 105, 112.5, 120, 127.5, 135, 150, 165, 180, 210 and 240
Some of these time points are difficult to determine. For example, below are the many steps it takes to measure precisely 71.25 minutes with four ropes. (Let ri represent rope i.)
- Light both ends of r1, one end of r2, and one end of r3
- 30 minutes pass (r1 burned through)
- Light the other end of r2 and one end of r4
- 15 minutes pass (r2 burned through)
- Light the other end of r3
- 7.5 minutes pass (r3 burned through)
- Light the other end of r4
- 18.75 minutes pass (r4 burned through)
The total time passed is 71.25 minutes (=30+15+7.5+18.75).
From the site fivethirtyeight, I found a solver (Thomas Conroy) who wrote a program in C++ to find the lengths of time, which he was kind enough to post to GitHub.
Finally, the following is the general solution for the number of lengths of time, T, you can measure with N ropes:
T = 3 * 2^(N-1) – 1
Hope you all enjoyed the puzzle!