Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
MR(n,k)=ispseudoprime(n,k);
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
sprp(n,b)={
|
||||
my(s = valuation(n-1, 2), d = Mod(b, n)^(n >> s));
|
||||
if (d == 1, return(1));
|
||||
for(i=1,s-1,
|
||||
if (d == -1, return(1));
|
||||
d = d^2;
|
||||
);
|
||||
d == -1
|
||||
};
|
||||
|
||||
MR(n,k)={
|
||||
for(i=1,k,
|
||||
if(!sprp(n,random(n-2)+2), return(0))
|
||||
);
|
||||
1
|
||||
};
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
A006945=[9, 2047, 1373653, 25326001, 3215031751, 2152302898747, 3474749660383, 341550071728321, 341550071728321, 3825123056546413051];
|
||||
Miller(n)={
|
||||
if (n%2 == 0, return(n == 2)); \\ Handle even numbers
|
||||
if (n < 3, return(0)); \\ Handle 0, 1, and negative numbers
|
||||
|
||||
if (n < 1<<64,
|
||||
\\ Feitsma
|
||||
for(i=1,#A006945,
|
||||
if (n < A006945[i], return(1));
|
||||
if(!sprp(n, prime(i)), return(0));
|
||||
);
|
||||
sprp(n,31)&sprp(n,37)
|
||||
,
|
||||
\\ Miller + Bach
|
||||
for(b=2,2*log(n)^2,
|
||||
if(!sprp(n, b), return(0))
|
||||
);
|
||||
1
|
||||
)
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue