Sz\303\241m\303\255t\303\263g\303\251pes sz\303\241melm\303\251letJ\303\241rai AntalEzek a programok csak szeml\303\251ltet\303\251sre szolg\303\241lnak1. A pr\303\255mek eloszl\303\241sa, szit\303\241l\303\241srestart; with(numtheory);1.1. A pr\303\255msz\303\241mt\303\251tel.[i$i=1..20]; evalf(map(i->log[2](mersenne([i])+1),%));1.2. K\303\251rd\303\251s: zeta gy\303\266kei.1.3. K\303\251rd\303\251s: \317\200(x).1.4. Ikerpr\303\255mek.1.5. K\303\251rd\303\251s: \317\200_2(x)1.6. K\303\251rd\303\251s: az ikerpr\303\255mek reciprokainak \303\266sszege.1.7. Sejt\303\251s.#
# This procedure approximate Cs calculating the product
# for primes below x.
#
Cs:=proc(s::posint,x::posint) local P,p;
P:=1.; p:=nextprime(s);
while p<x do P:=P*(1-s/p)/(1-1/p)^s; p:=nextprime(p) od;
P end;Cs(2,10); Cs(2,100); Cs(2,1000); Cs(2,10000); Cs(2,100000); Cs(2,1000000);1.8. P\303\251lda.f1:=h->(3.+30*h)*2.^38880.-1;
f2:=f1+2; f2(0);
g:=h->1/ln(f1(h))/ln(f2(h));2.^27/6*(g(0)+4*g(2.^26)+g(2.^27));Cf1f2:=C2*(1-1/3)^2/(1-2/3)*(1-1/5)^2/(1-2/5)/(1-1/2)^2/(1-1/3)^2/(1-1/5)^2;%%*20*0.66016;f1:=h->(5775.+30030*h)*2.^171960.-1;
f2:=f1+2; f2(0);
g:=h->1/ln(f1(h))/ln(f2(h));2.^33/6*(g(0)+4*g(2.^32)+g(2.^33));C2*(1-1/3)^2/(1-2/3)*(1-1/5)^2/(1-2/5)*(1-1/7)^2/(1-2/7)*(1-1/11)^2/(1-2/11)*(1-1/13)^2/(1-2/13);Cf1f2:=%/(1-1/2)^2/(1-1/3)^2/(1-1/5)^2/(1-1/7)^2/(1-1/11)^2/(1-1/13)^2;%*%%%; subs(C2=0.66016,%);1.9. K\303\251rd\303\251s.1.10. Eratoszten\303\251sz szit\303\241ja.sieve:=proc(N::posint) local n,B,i,j;
n:=floor((N-1)/2);
B:=Array(0..n-1);
for j from 0 to n-1 do B[j]:=1 od;
j:=0;
while j<n do
while B[j]=0 do j:=j+1 od;
i:=2*j^2+6*j+3;
if i>=n then break fi;
while i<n do B[i]:=0; i:=i+2*j+3 od;
j:=j+1;
od; B; end;debug(sieve); sieve(21);undebug(sieve); sieve(10000);1.11. Feladat.1.12. Modul\303\241ris inverz euklid\303\251szi algoritmussal.#
# Calculation of the greatest common
# divisor by the Euclidean algorithm.
#
eucgcd:=proc(x::integer,y::integer) local u,v,r;
u:=abs(x); v:=abs(y);
while v<>0 do r:=irem(u,v); u:=v; v:=r od;
u end;modinvdiv:=proc(a::integer,m::integer) local x1,x2,x3,d1,d2,d3,q,p;
x1:=1; d1:=a; x2:=0; d2:=m; p:=0;
do
if d2=0 then
if p=0 then return [x1,d1]
elif x1=0 then return [x1,d1]
else return [m-x1,d1]
fi;
fi;
q:=iquo(d1,d2); d3:=d1-q*d2; x3:=x1+q*x2; p:=1-p;
x1:=x2; x2:=x3; d1:=d2; d2:=d3;
od; end;
modinvdiv(13874,15543);1.13. Feladat.1.14. Modul\303\241ris inverz bin\303\241ris lnko algoritmussal.#
# Calculation of the greatest common
# divisor by the binary algorithm.
#
bingcd:=proc(x::integer,y::integer) local u,v,k,t;
u:=abs(x); v:=abs(y);
if u=0 then RETURN(v) fi;
if v=0 then RETURN(u) fi;
k:=0;
while type(u,even) and type(v,even) do k:=k+1; u:=u/2; v:=v/2 od;
if type(u,odd) then t:=-v else t:=u fi;
while t<>0 do
while type(t,even) do t:=t/2 od;
if t>0 then u:=t else v:=-t fi;
t:=u-v;
od; u*2^k end;1.15. Feladat.oddmodinvbin:=proc(a::nonnegint,m::posint)
local x1,x2,x3,d1,d2,d3,p;
if not type(m,odd) then return FAIL fi;
if m=1 then return [0,1] fi;
x1:=1; d1:=a mod m; x2:=m; d2:=m;
if type(d1,even) then x3:=0; d3:=m; p:=1 else x3:=1; d3:=d1; p:=0 fi;
while d3<>0 do
while type(d3,even) do d3:=d3/2;
if type(x3,even) then x3:=x3/2 else x3:=(x3+m)/2 fi;
od;
if p=0 then x1:=x3; d1:=d3 else x2:=m-x3; d2:=d3 fi;
if x1>=x2 then x3:=x1-x2 else x3:=m+x1-x2 fi;
if d1>=d2 then d3:=d1-d2; p:=0 else d3:=d2-d1; p:=1 fi;
od; [x1,d1] end;oddmodinvbin(13874,15543);1.16. \303\201ltal\303\241nos szita.1.17. Programoz\303\241si probl\303\251m\303\241k.#
# This procedure calculate the sum of the reciprocal
# of primes up to x and compare with ln(ln(x)).
#
sumprimerec:=proc(x) local s,p,i;
s:=0.; p:=2;
while p<x do
s:=evalf(s+1/p); p:=nextprime(p)
od; [s,evalf(s-ln(ln(x)))] end;sumprimerec(10); sumprimerec(100); sumprimerec(1000); sumprimerec(10000); sumprimerec(100000); sumprimerec(1000000);1.18. A szit\303\241l\303\241s d\303\272s\303\255t\303\263 hat\303\241sa.#
# This procedure calculate the factor qsAB.
#
qsAB:=proc(s::posint,A::posint,B::posint) local P,p;
P:=1.; p:=nextprime(A-1);
while p<B do P:=P*(1-s/p); p:=nextprime(p) od;
P end;
qsAB(1,1,100);B:=10: qsAB(1,1,B);
B:=100: qsAB(1,1,B);
B:=1000: qsAB(1,1,B);
B:=10000: qsAB(1,1,B);
B:=100000: qsAB(1,1,B);
B:=1000000: qsAB(1,1,B);1.19. P\303\251lda.qsAB(2,7,1000000);%*(ln(1000000.)/ln(44000.*2^25))^2;1.20. K\303\251rd\303\251s.1.21. K\303\251rd\303\251s.1.22. K\303\251rd\303\251s.1.23. K\303\251rd\303\251s.1.24. K\303\251rd\303\251s.1.25. K\303\251rd\303\251s.2. Egyszer\305\261 faktoriz\303\241l\303\241si m\303\263dszerek3. Egyszer\305\261 pr\303\255mtesztel\303\251si m\303\263dszerekLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn4. Lucas-sorozatok5. Alkalmaz\303\241sok 6. Sz\303\241mok \303\251s polinomok7. Gyors Fourier-transzform\303\241ci\303\2638. Elliptikus f\303\274ggv\303\251nyek9. Sz\303\241mol\303\241s elliptikus g\303\266rb\303\251ken10. Faktoriz\303\241l\303\241s elliptikus g\303\266rb\303\251kkel11. Pr\303\255mteszt elliptikus g\303\266rb\303\251kkel12. Polinomfaktoriz\303\241l\303\241s13. Az AKS teszt14. A szita m\303\263dszerek alapjaiLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn