Monday 1 April 2013

Problem Solving - Diagonals - Slog #9




Understanding the problem:
Well we have a rectangular grid made out of side length m and n. When a diagonal line is draw from the upper left corner to the bottom right corner, the diagonal will pass through some number of squares.

Problem: How many squares will the line cross through?

Devise a plan:
Depending on the orientation of the rectangle, side length (m,n) can be looked at as (n,m).
To simplify the problem, m will be the vertical side length and n will be the horizontal side length.
Also, we know that when m = n then the number of shaded sides would be m number.

Carry out the Plan:
After devising multiple scenarios, I noticed that when m is even and:
·         n is odd, the formula is n // 2 * m + 2
·         n is even, the formula is n//2 *m






(3//2 * 2)+ 2
= 4
4//2 * 2
= 4
(5//2 *2) + 2
= 6












2//2 * 4
= 4
(3//2 *4) + 2
= 6

Surely, this seems true for the above cases but as m and n becomes larger, this is obviously not true.

Looking Back:Unfortunately, this method was unsuccessful. After drawing a whole bunch of diagrams, there seems to be some relationship to the remainder (longest length % shortest length) since an equal grid would result in
 m % n = 0 + m or n = number of shaded squares. Ultimately at this moment, this is just a loose end and possibly a lead to the actual solution. .

No comments:

Post a Comment