If l and w don't have a common factor, then the number of squares cut=l+w-1
If l and w have a common factor, let gcd be m
then no. of squares cut=l + w -m
Consider a rectangle units long, and units wide and the unit squares found in it. A diagonal is drawn from one corner to the opposite. The diagonal cuts through certain unit squares. Find in terms of and the number of unit squares that are cut through.