summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormzuenni <mzuenni@users.noreply.github.com>2018-01-01 20:07:54 +0100
committerGitHub <noreply@github.com>2018-01-01 20:07:54 +0100
commitcef5b16480b1a2009fab7cad1b4d92974fc911e9 (patch)
treedbe1132281434ce13488e159feb9bace6deb2de5
parentdc1014bf6441d8bd61d4257fc481394736491da7 (diff)
fixed rho
-rw-r--r--math/primes.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/math/primes.cpp b/math/primes.cpp
index bbc63d9..79e0001 100644
--- a/math/primes.cpp
+++ b/math/primes.cpp
@@ -21,6 +21,7 @@ ll rho(ll n) { // Findet Faktor < n, nicht unbedingt prim.
while (d == 1) {
x = ((x * x) % n + c) % n;
y = ((y * y) % n + c) % n;
+ y = ((y * y) % n + c) % n;
d = gcd(abs(x - y), n); // Implementierung von oben.
}
return d == n ? rho(n) : d;