A rectangular floor that is feet wide and feet long is tiled with one-foot square tiles. A bug walks from one corner to the opposite corner in a straight line. Including the first and the last tile, how many tiles does the bug visit?
- A)
- B)
- C)
- D)
- E)
Answer
C
Key insight
Each time the diagonal crosses a grid line it enters a new tile; it crosses 16 vertical and 9 horizontal lines, never at a corner since gcd(10,17) = 1.
Solution
The bug starts in a corner tile. Every time its path crosses one of the interior grid lines it leaves one tile and enters a new one, so
provided the path never passes through a corner where a vertical and a horizontal line meet (which would count one crossing for two lines).
Between the two -foot walls there are interior vertical lines, and between the -foot walls there are interior horizontal lines. The diagonal passes through a lattice corner only at points with both coordinates integers; since that happens only at the two ends. So the crossings are all distinct.
Tiles visited: .
The answer is .
Why this works
A diagonal of an grid meets cells: horizontal crossings plus vertical crossings plus the first tile, minus the interior corners where two crossings coincide. Whenever the sides are coprime there are no such corners and the count is simply .
The trap
Answering 10 + 17 = 27 by forgetting that the starting tile is counted once, or forgetting the gcd correction in the general formula.
Common mistakes
- Answering 10 + 17 = 27 by forgetting that the starting tile is counted once, or forgetting the gcd correction in the general formula.
- Thinking the bug visits only one tile per column () or per row, as if the path moved in steps rather than continuously.
Techniques
Map the objects to something easier to count · Set up the equation/formula and compute; no special trick needed