TITLE: A weird function related to the denominators of rational squares
QUESTION [6 upvotes]: Between any consecutive integers $a$ and $a+1$ there are infinitely many rational squares of the form $t^2 / s^2$. I have been working to understand the following question: How small can $t$ and $s$ be? That is, let $\sigma (a)$ denote the least natural number $s$ for which there exists a natural number $t$ such that $(s^2)a < t^2 < (s^2)(a + 1)$. What are the properties of the function $\sigma (a)$?
It's not hard to calculate $\sigma (a)$ numerically, and the graph of the function is weird.  Full of crazy fluctuations but bounded by a smooth curve both above and below.  I've been working on this for a while now and have found some nice partial results, including sharp formulas for the lower and upper bounds, a criterion for when the upper bound is attained, and several special cases. (I'll be happy to share those with anybody who asks.)  I am at the point where I think I need to find out if anybody else has worked on this sort of thing before. Standard websearches haven't turned anything up. Does anybody know if this question has been previously investigated?

REPLY [2 votes]: I found this on the OEIS, but it doesn't list much information, so I don't know whether it's been studied before.  One way to look at it is that you're looking for the rational number with the smallest denominator between $\sqrt{n}$ and $\sqrt{n+1}$.  There are algorithms that use continued fractions to calculate the "best" rational in any given interval; see here.  Square roots have particularly nice continued-fraction representations, so you might even be able to get some sort of formula for $\sigma$.