Fermat's Method - Derive worst case $n=3p$

99 Views Asked by At

I am currently trying to understand Fermat's method: for a number $n$ we start with $x=\lceil\sqrt{n}\rceil$ and check if $\sqrt{x^2-n}\in\mathbb N$, if not, increase $x$ and try again, etc. until $x^2-n=y^2$ and hence $n=(x+y)(x-y)$.

I think I understand the overall concept, but what I don't get is why we only have to check the values of $x$ such that $x\le\frac{n+9}{6}$ (e.g. according to Pomerance's and Crandall's book on page 226). It seems to be related to the worst case $n=3p$.

It appears to be a trivial fact (to them), but I don't seem to be able to figure it out.

1

There are 1 best solutions below

1
On BEST ANSWER

Suppose that there exist a non-trivial solution (i.e., $x-y\geq 3$) such that $x>\frac{n+9}{6}$. Then $$\left(\frac{n+9}{6}\right)^2-y^2<n\iff\\ y>\frac{n-9}{6}.$$ Therefore, we have $x+y>\frac{n}{3}$. This implies that $x-y<3$ which is a contradiction.