Factor 262063 and 181937053 using the Pollard Rho Algorithm where f(x)=x2+1. How many iterations are needed to factor each number? Show main steps of your work.

I did it but I got 35 iterations for the first number and 640 iteration for the second number.

could u please help me if my answers correct or not and also how to writl this method in mathematica or matlab maybe mine is wrong.

this is alg.

Inputs: n, the integer to be factored; and f(x), a pseudo-random function modulo n

Output: a non-trivial factor of n, or failure.

x ← 2, y ← 2; d ← 1

While d = 1:

x ← f(x)

y ← f(f(y))

d ← GCD(|x − y|, n)

If d = n, return failure.

Else, return d.

any help will be appreciated. thanks.