Content deleted Content added
→The basic method: Slowest edit war ever? Please explain reasoning if reverting again. |
m →The basic method: use consistent case |
||
Line 13:
:FermatFactor(N): // N should be odd
::
::
::while
:::
:::
::endwhile
::return
For example, to factor <math>N=5959</math>, one computes
{| class="wikitable"
! a:
| 78
| 79
| 80
The third try produces a square. <math>A=80</math>, <math>B=21</math>, and the factors are <math>A-B = 59</math>, and <math>A+B = 101</math>.▼
|-
! b2:
| 125
| 282
| 441
|}
▲The third try produces a square. <math>
Suppose N has more than two prime factors. That procedure first finds the factorization with the least values of ''a'' and ''b''. That is, <math>a+b</math> is the smallest factor ≥ the square-root of ''N''. And so <math>a-b = N/(a+b)</math> is the largest factor ≤ root-''N''. If the procedure finds <math>N=1*N</math>, that shows that ''N'' is prime.
|