我正在尝试在Haskell中实现Pollard Rho分解方法.这是我来的
func :: Int -> Int -> Int
func x n = mod ( x * x - 1) n
pollardStep :: Int -> Int -> Int -> Int -> Int -> Int
pollardStep i k n x y
| d /= 1 && d /= n = d
| i == k = pollardStep (i+1) (2*k) n x1 x1
| otherwise = pollardStep (i+1) k n x1 y
where d = gcd n $ abs $ …Run Code Online (Sandbox Code Playgroud)