Pollard[n_] := Module[{a,x,y,q=1,c=1,max=1000},
r:=1+Prime[Random[Integer,max]];
  While[q<2, a=r; x=r; y=x; c=1;
   While[q<2 && c<Floor[Sqrt[n]], Do[x=Mod[x*x-a,n]; y=Mod[y*y-a,n];
y=Mod[y*y-a,n];
     q=Mod[q*(x-y),n],{i,20}]; q=Mod[GCD[n,x-y],n]; c++;];
   Return[GCD[n,x-y]] ]]
T[n_]:=Timing[Pollard[Prime[n]*Prime[n+1]]] [[1,1]];
Do[Print[T[n]],{n,100,1000}]

