If you are implementing the algorithm in the wikipeida page you are doing a few things wrong.
Line 24 should be while(d == 1)
Line 27 is probably wrong. Note that they use f(f(y)) and not f(y).
line 28 you should use the absolute value of x-y.
Yeah,i know it says d==1 on the wiki page,i was using my declaration cause it worked even when d is negative(because of my gcd function).
But using absolute value should take care of that:)
1 2 3 4 5 6
|
while(d==1)
{
x=(x*x+1)%n;
y=(x*x+1)%n;
d=gcd(n,abs(x)-abs(y));
}
|
Still dont know tho what i should about the Y value tho..
Last edited on
Dosent work:(
Oh well,gonna try it again later on..
Actually it does,i get 23 as divisor,115/23=5.