Others‎ > ‎3. Games & Puzzles‎ > ‎

6. Diagonal Problem

(Automatic Counting Version)
Given a rectangle with dimensions n x m. Develop a rule to determine how many squares through which the diagonal will pass. 

Credit: rami for the construction showing shaded squares.

When you move the point around to change the size of your rectangle, you will notice that the diagonal passes through certain squares and misses others. When the rectangle is small, it is easy to simply count the squares. 

Your task: Write a rule that will allow you to take the length and width of the rectangle and determine the number of squares through which the diagonal passes without having to actually count the squares.

(Manual Counting Version)
Touch or click to shade and count the squares at the diagonal. Drag the red point to change the dimensions of the rectangle.
How many squares does the diagonal of the rectangle pass through? Find a rule to determine the number of squares.