Square form factorization: Difference between revisions

One less branching statement in 'classical heuristic' C code
m (→‎{{header|REXX}}: shortened the program.)
(One less branching statement in 'classical heuristic' C code)
Line 249:
rhoin(a, b, c)
 
ix = floor(sqrt(2*r)) * 4;
//iteration bound
ix = floor(sqrt(2*r)) * 42;
 
//search principal cycle
for (i = 2; i < ix; i++) {
//search principal cycle
 
rho(a, b, c)
if//even ((i & 1) == 0) {step
r = floor(sqrt(c)+0.5);
 
if (r * r == floor(sqrt(c) {+0.5);
if (r * r == c) //square form found{
//square form found
 
//inverse square root
v = -b; w = r;
rhoin(u, v, w)
 
//search ambiguous cycle
do { r = v;
rho(u, v, w)
} while (v != r);
//symmetry point
 
h = N; gcd(h, u)
if (h != 1) return h;
}
}
rho(a, b, c)
//odd }step
}
}