summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorPaul Jungeblut <paul.jungeblut@gmail.com>2018-01-02 08:54:48 +0100
committerGitHub <noreply@github.com>2018-01-02 08:54:48 +0100
commit6a1f848405bf1084a21222e0515c7b461c588845 (patch)
tree5f039a5496821e9422859c385702adbff1a4df35 /math
parent9facd3655e2b86799699a6fdbd566cb4b2a7fb1c (diff)
parentcef5b16480b1a2009fab7cad1b4d92974fc911e9 (diff)
Merge pull request #42 from mzuenni/master
fixed rho
Diffstat (limited to 'math')
-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;