Skip to content

Commit bd3e052

Browse files
authored
Merge pull request #98 from mlochbaum/master
Fix ys in Pollard's rho algorithm
2 parents 0cb178e + a27b385 commit bd3e052

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Primes.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ function pollardfactors!(n::T, h::AbstractDict{K,Int}) where {T<:Integer,K<:Inte
395395
G::T = 1
396396
r::K = 1
397397
y::T = rand(0:(n - 1))
398-
m::K = 1900
398+
m::K = 100
399399
ys::T = 0
400400
q::T = 1
401401
x::T = 0
@@ -411,8 +411,8 @@ function pollardfactors!(n::T, h::AbstractDict{K,Int}) where {T<:Integer,K<:Inte
411411
k::K = 0
412412
G = 1
413413
while k < r && G == 1
414+
ys = y
414415
for i in 1:(m > (r - k) ? (r - k) : m)
415-
ys = y
416416
y = y^2 % n
417417
y = (y + c) % n
418418
q = (q * (x > y ? x - y : y - x)) % n

0 commit comments

Comments
 (0)