Square form factorization: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: shortened the program.) |
(One less branching statement in 'classical heuristic' C code) |
||
Line 249: | Line 249: | ||
rhoin(a, b, c) |
rhoin(a, b, c) |
||
⚫ | |||
//iteration bound |
//iteration bound |
||
⚫ | |||
⚫ | |||
for (i = 2; i < ix; i++) { |
for (i = 2; i < ix; i++) { |
||
⚫ | |||
rho(a, b, c) |
rho(a, b, c) |
||
//even step |
|||
r = floor(sqrt(c)+0.5); |
|||
r = floor(sqrt(c)+0.5); |
|||
if (r * r == c) { |
|||
//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) |
|||
⚫ | |||
} |
} |
||
} |
} |