Pokusna slozena cisla: N=246082373; N=1612561890502118556059; N=1612561892911521555599; ___________________________________________________________________ Pollardova rho-metoda N je slozene cislo, jehoz rozklad hledame, H udava pocet iteraci, ktery jsme ochotni udelat PollardRho(N,H)= \ x=Mod(1,N);y=x; \ d=1;m=0; \ until(d>1||m>H, \ x=x^2+1;y=y^2+1;y=y^2+1;m=m+1; \ d=gcd(lift(x-y),N); \ print(m," ",lift(x)," ",lift(y)," ",d)); \ if(d>1,print("Hledany delitel je ",d)) ___________________________________________________________________ Pollardova (p-1)-metoda N je slozene cislo, jehoz rozklad hledame, B udava hranici (mame nadeji na uspech, je-li N delitelne prvocislem p, pro ktere je p-1 B-hladke) Pollard_p1(N,B)= \ p=1;a=Mod(2,N); \ until(d>1||p>B,p=p+1; \ if(isprime(p),q=p; \ until(q>B||d>1, \ q=q*p;a=a^p; \ d=gcd(N,lift(a-1));print(p," ",d)))) ___________________________________________________________________ Lenstrova metoda eliptickych krivek N je slozene cislo, jehoz rozklad hledame, B udava hranici (mame nadeji na uspech, je-li N delitelne prvocislem p, pro ktere pocet prvku nektere z B zvolenych eliptickych krivek modulo p je B-hladky) Lenstra(N,B)= \ a=0; \ until(a>B,a=a+1;print(a); \ p=1;A=[0,1];E=ellinit([0,0,0,a,1]*Mod(1,N)); \ until(d>1||p>B,p=p+1; \ if(isprime(p),q=p; \ until(q>B||d>1, \ q=q*p;A=ellpow(E,A,p); \ d=gcd(N,lift(A[1])))))) ___________________________________________________________________ Lehmanova metoda n je slozene cislo, jehoz rozklad hledame, nejprve provedeme pokusne deleni az do treti odmocniny z n, pak se uzije Lehmanova veta lehman(n)=\ r=truncate(n^(1/3));\ if(n%2==0,print("Delitel 2"),p=1;d=1;\ until(d>1||p>r,p=p+2;if(n%p==0,d=p));\ if(d>1,print("Delitel ",p), \ print("Pokusne deleni delitele nenaslo");\ k=0;until(d>1||k>r,k=k+1;x=truncate(sqrt(4*k*n));\ xmax=x+1+truncate(sqrt(n/k)/(4*(k+1)));\ if(k%2==0,if(x%2==0,x=x+1);h=2,if(x%2==1,x=x+1);\ if((x-k-n)%4==2,x=x+2);h=4);\ until(d>1||x>xmax,if(issquare(x*x-4*k*n),y=round(sqrt(x*x-4*k*n));\ d=gcd(n,x-y);print(x," ",y," ",k," ",d));x=x+h));\ print("Delitel ",d))) ___________________________________________________________________