I find a interesting question of my PRMO mock and 2019 AMC 10A
The rectangular floor of a bathroom is covered with square tiles (all of the same size). A spider starts at one corner of the bathroom, and walks to the corner diagonally opposite. For example, the figure below shows a 6 × 8 bathroom, in which the spider touches 12 tiles on its path. (A spider doesn’t touch a tile if it just walks over the grout at the corner of a tile.) For an $m\times n$ bathroom, how many tiles does the spider touch on its walk?
My assumption is that number of tiles bugs walk through is $2* (\text{no. of columns})$ but I am unable to prove it.
Can anyone please help me with solution?



First, we assume $(m,n)=1$.
Let's locate the rectangular on the coordinate system such that the beginning corner is $(0,0)$ and the final corner is $(m,n),$ and each intersection inside the rectangular has integer coordinates. Due to assuming $(m,n)=1$, the spider does not cross any intersection. This fact leads to the conclusion below.
In general, for the $k$th column ($k <m$), the spider touches $[\frac{k(n)}{m}]-[\frac{(k-1)n}{m}]+1$ tiles of the $k$the column.
To prove that, just consider the intersections of pairs of lines $y=\frac{n}{m}x, x=k-1$ and $y=\frac{n}{m}x, x=k.$
However, for the $m$th column, since $\frac{nm}{m}$ is an integer, the spider touches $[\frac{mn}{m}]-[\frac{(m-1)n}{m}]$ tiles. Therefore,
$$[\frac{n}{m}]+1 + ([\frac{2n}{m}]-[\frac{n}{m}]+1) + ([\frac{3n}{m}]-[\frac{2n}{m}]+1) + ... + ([\frac{mn}{m}]-[\frac{(m-1)n}{m}]) \\ =m-1 +n$$
is the total number of tiles that the spider touches.
If $(m,n)=d$, then the $\frac{m}{d} \times \frac{n}{d}$ rectangular repeats $d$ times in the main rectangular. For example, in your case where $(6,8)=2$:
The answer is $m+n-(m,n)$.