Fermat Factoring utilizes the fact that the difference between two perfect squares is an odd number. Therefore, since x2 - y2 factors to (x+y)(x-y)
This process will work with select even numbers. However, even numbers may continue infinitely in the calculation.
Following is the process:
| 2047 | Number to be factored |
| x = 46 | The Square Root of 2047 plus 1 |
| 2116 - 2047 = 69 | 46 squared minus the original number. if the result is a perfect square we have x and y, but it is not. |
| 2(46) + 1 = 93 | multiply the original x by 2 and add 1 |
| 162 | add the two numbers if the result is a perfect square we have x and y, but it is not. |
| 2(47) + 1 = 95 | Add 1 to x and multiply by 2 and add 1 |
| 257 | add the two numbers if the result is a perfect square we have x and y, but it is not. |
| 2(48) + 1 = 97 | Add 1 to x and multiply by 2 and add 1 |
| 354 | add the two numbers if the result is a perfect square we have x and y, but it is not. |
| 2(49) + 1 = 99 | Add 1 to x and multiply by 2 and add 1 |
| 453 | add the two numbers if the result is a perfect square we have x and y, but it is not. |
| 2(50) + 1 = 101 | Add 1 to x and multiply by 2 and add 1 |
| 554 | add the two numbers if the result is a perfect square we have x and y, but it is not. |
| 2(51) + 1 = 103 | Add 1 to x and multiply by 2 and add 1 |
| 657 | add the two numbers if the result is a perfect square we have x and y, but it is not. |
| 2(52) + 1 = 105 | Add 1 to x and multiply by 2 and add 1 |
| 762 | add the two numbers if the result is a perfect square we have x and y, but it is not. |
| 2(53) + 1 = 107 | Add 1 to x and multiply by 2 and add 1 |
| 869 | add the two numbers if the result is a perfect square we have x and y, but it is not. |
| 2(54) + 1 = 109 | Add 1 to x and multiply by 2 and add 1 |
| 978 | add the two numbers if the result is a perfect square we have x and y, but it is not. |
| 2(55) + 1 = 111 | Add 1 to x and multiply by 2 and add 1 |
| 1089 | add the two numbers The result is a perfect square we have x and y |
| x = 56 | Add 1 to x |
| y = 33 | The square root of 1089 = 33 this is the value of y. |
| (x+y)(x-y) = 2047 | we just need to substitute x and y and we have the answer |
| (56+33)(56-33) = 2047 | substituting x and y |
| (89)(23) = 2047 | Eureka! |
Further analysis of the process allows us to observe the following:
if z = integer part of the square root of N plus 1, and
a = the number of steps to the solution for Fermat Factoring then
x = a + z, and
The maximum that a can achieve, for a prime number for instance, is:
a = [(N-1)/2] + 1 - z
Another helpful fromula is the sum of an odd series:
2az + a2 where the first number in the series is represented by 2z + 1 and
a = the count of the odd numbers in the series.