Question 890619
If the floor is completely covered with the tiles, then {{{m/n}}} is a positive integer.
That is the number of tiles along each side of the square room,
and it is also the number of tiles in the diagonal.
The total number of tiles is {{{(m/n)^2}}} .
 
If {{{m/n}}} is even, in an alternating pattern, half of the tiles would be red.
The final number of red tiles would be
{{{(m/n)^2/2}}}
The number of green tiles replaced (the number of red tiles added) would be
{{{(m/n)^2/2-m/n=(m/n)(m/2n-1)}}}
 
If {{{m/n}}} is an odd number, an alternating pattern with a red diagonal would have
{{{((m/n)^2+1)/2}}} red tiles and {{{((m/n)^2+1)/2}}} green tiles.
The number of green tiles to be replaced (the number of red tiles to be added) would be
{{{((m/n)^2+1)/2-m/n=(1/2)((m/n)^2+1-2(m/n))=(1/2)((m/n)-1)^2}}}
 
UNFORTUNATELY, there is no simple formula that covers both cases (when {{{m/n}}} is even, and when {{{m/n}}} is odd).
If you want a single formula, I would have to write something complicated, like
{{{m^2/2n^2-m/n-(1/4)(-1+(-1)^(m/n))}}} or {{{(1/2)(m/n-1)^2-(1/4)(1+(-1)^(m/n))}}}


For {{{m/n=9}}} , which is odd, we are replacing
{{{(1/2)((m/n)-1)^2=(1/2)(9-1)^2=(1/2)*8^2=64/2=32}}} tiles, or
{{{m^2/2n^2-m/n-(1/4)(-1+(-1)^(m/n))=9^2/2-9-(1/4)(-1+(-1)^9)=81/2-9-(1/4)(-1+(-1))=81/2-9-(1/4)(-2)=81/2-9+1/2=41-9=32}}} tiles, or
{{{(1/2)(m/n-1)^2-(1/4)(1+(-1)^(m/n))=(1/2)(9-1)^2-(1/4)(1+(-1)^9)=(1/2)*8^2-(1/4)(1+(-1))=(1/2)*64-(1/4)*0=64/2=32}}} tiles.
{{{drawing( 400, 400, 3.13,31.5, 3.13,31.5,
green(triangle(2pi,pi,10pi,pi,10pi,9pi)),
green(triangle(pi,2pi,pi,10pi,9pi,10pi)),
graph( 400, 400,  pi,10pi, pi,10pi, sin(x)*sin(y) > 0.1))}}} The new (replacement) red tiles are the ones in the green triangles.
There are {{{7+5+3+1=16}}} in each triangle.