cloudspokes / arena-web

Web arena for SRMs
44 stars 32 forks source link

pollard rho算法 #1121

Closed apolloliu closed 9 years ago

apolloliu commented 9 years ago

int pollard_rho(int n, int c)///c为自己设定的某值 { int x, y, d, i = 1, k = 2; x = rand() % (n - 1) + 1; y = x; while (true) { ++i; x = (modular_multi(x, x, n) + c) % n; d = gcd(y - x, n); if (1 < d && d < n) return d; if (x == y) return n; if (i == k) y = x, k <<= 1; } }

skyhit commented 9 years ago

what is this?

apolloliu commented 9 years ago

It is an algorithm named pollard rho.

skyhit commented 9 years ago

this is not related to this repository, right/