TITLE: Bound on gcd of two integers
QUESTION [10 upvotes]: Well this is a problem I was fiddling with. I came up with it but it probably is not original.

Suppose $a\in \mathbb{N}$ is not a perfect square. Then show that :
  $$\text{gcd}(n,\lfloor{n\sqrt{a}}\rfloor)\le c\sqrt n\tag{1}$$ Where $c=\sqrt[4]{4a}$ and P.S. it is the best constant, when $ax^2-y^2=1$ admits a solution. 

Now I have a couple questions. 

When $ax^2-y^2=1$ has no solution, what could be the best constant $c$ in $(1)$ then? 
What about when $\dfrac{\text{gcd}(n,\lfloor{n\alpha}\rfloor)}{\sqrt n}$we have a irrational number $\alpha$ which is not a quadratic surd. For example, $\pi,\sqrt[3]{2}$ etc?

Any references or solutions would be helpful. Thanks.

REPLY [10 votes]: Robert Israel's nice answer above already points to what happens if there are very good rational approximations to the irrational number $\alpha$.  Let me just address the first question when $\alpha =\sqrt{a}$ is a quadratic irrational (with $a$ being a non-square natural number).  Let $k$ be the least positive number that can be expressed as $ax^2-y^2$.  Then the best constant in the bound for the gcd is $\sqrt{2\sqrt{a}/k}$.  
To see this, suppose $g=(n,\lfloor n\alpha \rfloor)$, and write $n=gv$ and $\lfloor n\alpha \rfloor =gu$.  Then 
$$ 
\frac{1}{n} > \alpha -\frac{u}{v} > 0,
$$ 
and multiplying both sides by $\alpha+u/v \le 2\alpha$ we get 
$$ 
\frac{2\alpha}{n} \ge \alpha^2 -\frac{u^2}{v^2} \ge \frac{k}{v^2},
$$ 
since $k$ is the smallest positive number of the form $a x^2- y^2$.  Since $v=n/g$, we conclude that 
$$ 
g^2 \le \frac{2\alpha}{n} \frac{n^2}{k} = \frac{2\alpha n}{k},
$$ 
which is the claimed bound.  
To see that this bound is asymptotically attained, take a solution to $ax^2 -y^2 =k$ and by multiplying by a solution to the Pell equation $x^2-ay^2=1$ we can find a solution to $ax^2 -y^2 =k$ with $x$ and $y$ arbitrarily large.  Further such $x$ and $y$ may be assumed to be coprime by the minimality of $k$.   For such a choice we know that 
$$ 
\alpha - \frac{y}{x} \approx \frac{k}{2\alpha x^2}, 
$$ 
and choosing $n= x \lfloor (1-\epsilon) 2\alpha x/k\rfloor$ produces a large gcd for $n$ and $\lfloor n\alpha\rfloor$.  
Finally the negative Pell equation $ax^2-y^2=1$ has been extensively studied, and still remains not fully understood.  See for example this impressive recent paper of Fouvry and Kluners in Annals.  It may also be interesting to note that there do exist $a$ for which $k$ is essentially as large as possible:  namely take $a$ of the form $b(b+2)$ and then the corresponding $k$ is $2b$.  (One can see this from the fact that the continued fraction expansion for $\sqrt{b(b+2)}$ is $[b;1,2b,1,2b,\ldots]$.)