When the average will change?

Solution 1:

The properties of flooring allow us to simplify the expression to $$ \left\lfloor \frac{ x + N/x}{2}\right\rfloor $$ We can also tell that the value will change between $x$ and $x + 1$ if there is a real number $y$, $x < y < x+1$ such that $(y + N/y)/2$ is an integer. Calling this integer $k$, we can set $k = (y + N/y) /2$ and solve for $y$ to get $$ x = \lfloor y \rfloor = \lfloor k \pm \sqrt{k^2 - N}\rfloor $$ Applying this formula to the values $[678, 683]$ gives $615, 606, 598, 591, 585, 579$, which lines up perfectly with the spreadsheet.