I have the Fermat Factorizations of $n = pq$ where $p$ and $q$ are primes. I am trying to find a formula/pattern for the number of cycles required to perform the factorization in terms of $n, p, q$. Here is a set of integers I have interated over:
FermatFactorization(15) (5)(3)
NumCycles: 1
FermatFactorization(21) (7)(3)
NumCycles: 2
FermatFactorization(33) (11)(3)
NumCycles: 5
FermatFactorization(35) (7)(5)
NumCycles: 1
FermatFactorization(39) (13)(3)
NumCycles: 6
FermatFactorization(51) (17)(3)
NumCycles: 9
FermatFactorization(55) (11)(5)
NumCycles: 3
FermatFactorization(57) (19)(3)
NumCycles: 11
FermatFactorization(65) (13)(5)
NumCycles: 4
FermatFactorization(69) (23)(3)
NumCycles: 14
FermatFactorization(77) (11)(7)
NumCycles: 2
FermatFactorization(85) (17)(5)
NumCycles: 7
FermatFactorization(87) (29)(3)
Can you find the formula for the given data as described above?
The first question to ask is how is the value of $X = s + a$ ( half the sum of the factors) related to $p\text{ and }q$, the factors of $N$. $2X = 2s + 2a$ is the sum of the factors of $N$; how can we relate this to $p\text{ and }q$?
We define p and q as follows: $$ \begin{align} s &= \lfloor\sqrt{N}\rfloor\\ q &= s - t &\text{($t$ is an integer)}\\ p &= s + t + k &\text{( $k$ is an integer)} \end{align} $$ I have used $p$ as the larger number as it was used like that in the answer above.
The sum of the factors $= q + p = ( s - t) + ( s + t + k) = 2s + k$.
We also know that the sum of the factors is $2s + 2a$ therefore we have $2s + 2a = 2s + k$, and $a = k/2$.
From this we can use the defined $p$ and $q$ as follows: $$ \begin{align} N &= qp = (s- t)(s + t + k)\\ N &= s^2 - t^2 + sk - tk\\ \end{align} $$ Solving for $k$ gives $k = (t^2 + N - s^2)/(s - t)$
This will give you a formula for $2a$, so half the value will be the values that you have calculated above.
There is no formula in terms of $N,p\text{ and }q$ though!