# Continued Fractions Applied to the One Line Factoring Algorithm for Breaking RSA
## 6 Extension to Research Using Difference of Squares  
Our research investigations through the experimental study conducted have resulted in several findings, as described in previous sections. These form encouraging foundations for us to explore the theory of the difference of squares as a future research direction. Our observations from the practical examples given above motivate us to extend our research using difference of squares. We now explore this idea of difference of squares with the Brahmagupta-Fibonacci identity [33], normally applied to \(P\) and \(Q\) each as a sum of two squares. We apply the Brahmagupta-Fibonacci identity to \(P\) and \(Q\) which we now express as a difference of two squares. We note that the Brahmagupta-Fibonacci identity has an inherent constraint in that it can only be applied to semi-primes congruent to \(1 mod4\). Further, the two primes forming the construction of the semi-prime must also be congruent to \(1 mod4\). This constraint limits the solvable semi-primes to a quarter of the possibilities. We are limited to only \(1 mod4=1 mod4*1 mod4\) for the solvable semi-primes as \(3 mod4=1 mod4*3 mod4\), \(3 mod4=3 mod*1 mod4\), \(1 mod4=3 mod4*3 mod4\) cannot be resolved. We note that the Brahmagupta-Fibonacci two-square identity is analogous to [PERSON]'s four-square identity and this is relevant to the semi-prime factorization problem. A summary follows of the Brahmagupta-Fibonacci identity as well as its extensibility, which is also known as Euler's Factorization. Previously, the result arrived at was a sum of four squares which can be expressed as the product of two sums of two squares, as shown below:  
\[N=(x_{1}y_{1})^{2}+(x_{1}y_{2})^{2}+(x_{2}y_{1})^{2}+(x_{2}y_{2})^{2}=\left(x_{1 }^{2}+x_{2}^{2}\right)\left(y_{1}^{2}+y_{2}^{2}\right)\]  
[PERSON]'s factorization method [23] can be mathematically formulated as shown below:  
\[N=(x_{1}y_{1}-x_{2}y_{2})^{2}+(x_{1}y_{2}+x_{2}y_{1})^{2}=(x_{1}y_{1}+x_{2}y_{ 2})^{2}+(x_{1}y_{2}-x_{2}y_{1})^{2}\]  
The parity (\(E\): even; \(O\): odd) of the squares can be used to find a factor, as presented in our earlier work [15]. \[P=(E_{1}-E_{2})/(O_{1}-O_{2})\,Q=(E_{1}+E_{2})/(O_{1}-O_{2})\]  
We observe that the limitation of the sum of four squares is that it only applies to \(P,Q\equiv 1 mod4\), which relates to [PERSON]'s Christmas Theorem discovered as early as 1640. [PERSON]'s Christmas Theorem on the sum of two squares states that an odd prime can be expressed as \(P=x^{2}+y^{2}\) if \(P\equiv 1\ mod\ 4\). The method outlined above is restricted to provide factors of semi-primes whose construction is of the form \(N=PQ:\ 1 mod4=1 mod4*1 mod4\) only. The solutions are limited in this case. It is observed that with \(3 mod4=1 mod4*3 mod4\), \(3 mod4=3 mod4*1 mod4\), \(1 mod4=3 mod4*3 mod4\), the solvable semi-primes cannot be resolved. We now propose an extension to the Brahmagupta-Fibonacci identity outlined above by **not** considering the **sums** of squares for the two prime number construction of the semi-prime. Instead, we will now consider the difference of squares. Using the difference of squares allows all of the primes, both \(1 mod4\) and \(3 mod4\), to be expressed in this way. By considering the difference of squares all primes can be considered, and, as a consequence, all semi-prime constructions may now be considered (not just the \(1 mod4=1 mod4*1 mod4\) constructions). The limitation of the sums of squares method of factorization is the key motivation in our work to consider the difference of squares. We then investigated with the following question in mind:  
Can we modify the Brahmagupta-Fibonacci identity [33] so that it can be applied to the difference of squares? If we can find such a method, then we posit that [PERSON]'s factorization can be used. \[N=x_{1}^{2}-x_{2}^{2}=(x_{1}-x_{2})(x_{1}+x_{2})\]  
This removes the \(1 mod4\) constraint and includes all primes, namely \(1 mod4 and3 mod4\).