Factoring Integers_Part 4 

Let's see that in action. Let's factor 4429. We need to find the continued fraction for $\sqrt{4429},$ which is 66.550733... or so. So to start with, $\sqrt{4429}$ is 66 and a bit, and then we take the reciprocal of "the bit", and repeat:

We use q for the integer part.
After a time these sums become less and less accurate because of rounding errors. There is a way to compute using exact integer arithmetic, but that's a detail we won't go into here. 
Now we remember, successive truncations of the continued fraction give rational approximations and get closer and closer, converging to the true value. These truncations are called the convergents, and we now compute them.

66  1  1  4  2  2  1  25  ...  
0  1  66  67  133  599  1331  3261  4592  ...  ... 
1  0  1  1  2  9  20  49  69  ...  ... 
See if you can see the rule being used to compute the table.
So the convergents are:

As you can see, the third column is mostly quite small numbers. We've included the factorisations of some of these, and combining those we get (2*2*3*5)*(1*3*3*3)*(1*5) which is (2*3*3*5)^2, or 90^2.
So, working modulo 4429, (67*133*4592)^2=90^2
We compute 67*133*4592 mod n is 4210, so we have $4210^2=90^2$
That means, if this has worked, that (4210+90)*(421090) is 0 mod n and hence is a multiple of n. We hope, then, that some of the factors of n are in 421090, and some are in 4210+90.
And they are. Using the GCD we can extract the factors from 4429 as follows:
And it's right: 43*103 = 4429, and we're done.
Next, Factoring Integers_Part 5, where we see how to find factorisations that can be combined to produce a square.