In this particular problem, we are presented with a grid of m rows and n columns with a line drawn diagonally through it. We want to know how many grids will have the line pass through it. We want to come up with some formula that we can use to determine the number of squares that the line will pass through given a specific m and n.
The unknowns here are the m and n, so our formula will need to include these as variables.
We are given an example figure of m=4 and n=6. Below, is a recreation of the figure, along with a simpler version of m=2 and n=3.
First, we should notice that this pattern seems to continue. To be sure, we created an extended version as seen below.
Therefore, we should take into mind this repeating pattern when coming up with a formula. From our simpler figure above, we see that there are 4 squares covered by the line for every 2 rows and 3 columns. This can be extended to say that there are 4 squares for every 2m rows and 3n columns.
A few other things we should consider are:
- There is 1 of 1 square crossed by the line when m=1 and n=1.
- There is 2 of 2 squares when m=1 and n=2.
- There is 3 of 4 squares when m=2 and n=2.
- There is 4 of 6 squares when m=2 and n=3.
- There is 4 of 9 squares when m=3 and n=3.
- There is 5 of 12 squares when m=3 and n=4.
- There is 5 of 16 squares when m=4 and n=4.
- There is 7 of 20 squares when m=4 and n=5
- There is 7 of 25 squares when m=5 and n=5.
- There is 8 of 30 squares when m=5 and n=6.
From this, we can draw the conclusion that it is possible to have the same number of squares crossed by the diagonally line given different m and n. This proves a bit troublesome. A piece-wise function or a formula that relies on cases will be required. So I'll stop here.
4. Looking back