Fading Coder

One Final Commit for the Last Sprint

Optimizing Fermat's Factorization Method for Prime Number Identification

Any odd integer $n$ can be represented as the difference of two squares. Given two factors $a$ and $b$ such that $n = ab$, we can define: $$n = ab = (x+y)(x-y) = x^2 - y^2$$ Consequently, the factors relate to the squares as $a = x+y$ and $b = x-y$. Solving for $x$ and $y$ yields $x = (a+b)/2$ and $...