}
+/* Algorithm C from Knuth's Art of Computer Programm 2: Seminumerical Algorithms */
+/* Fermat like factorization */
+/* page 387 */
+void factor_int2(mpz_class N)
+{
+ unsigned long a = (unsigned long)(2*sqrt(N.get_ui())+1);
+ unsigned long b = 1;
+ signed long r = (signed long)((unsigned long)(sqrt(N.get_ui()))*(unsigned long)(sqrt(N.get_ui()))-N.get_ui());
+
+ while(r!=0)
+ {
+ r = r+a;
+ a = a+2;
+
+ while(r > 0)
+ {
+ r = r-b;
+ b = b+2;
+ }
+
+ }
+ cout << "Found prime-factors: " << (a-b)/2 << " and " << ((a+b-2)/2) << endl;
+}
+
int main()
{
mpz_class N;
cout << factors[i] << " ";
cout << endl;
+ factor_int2(N);
+
return (0);
}