![]() |
|
|
#1 |
|
Oct 2008
24 Posts |
I want to know several algorithms about primality in pari/gp.
the function name is “ispseudoprime”。 who can describe the algorithms which are used in ispseudoprime? the more detailed the better! Is there anyone who can provide me with the source code which are used in "ispseudoprime"? ![]() Until now ,Which algorithm is the best to test a given number is prime or not ? As we know ,before you factorize a given number ,you must test the given number is prime or not ! Last fiddled with by aaa120 on 2008-11-18 at 12:13 |
|
|
|
|
|
#2 |
|
Tribal Bullet
Oct 2004
1101110101012 Posts |
|
|
|
|
|
|
#3 |
|
Feb 2006
Denmark
111001102 Posts |
If you have PARI/GP then just type "?ispseudoprime" to get:
ispseudoprime(x,{n}): true(1) if x is a strong pseudoprime, false(0) if not. If n is 0 or omitted, use BPSW test, otherwise use strong Rabin-Miller test for n randomly chosen bases. PARI/GP is open source. The source simply calls another function depending on the second parameter: long ispseudoprime(GEN x, long flag) { if (flag == 0) return BSW_psp(x); return millerrabin(x, flag); } |
|
|
|
|
|
#4 | |
|
Oct 2008
24 Posts |
Quote:
very well. |
|
|
|
|
|
|
#5 |
|
Oct 2008
24 Posts |
The source simply calls another function depending on the second parameter:
long ispseudoprime(GEN x, long flag) { if (flag == 0) return BSW_psp(x); return millerrabin(x, flag); }[/quote] I have installed pari/gp and type" long ispseudoprime(GEN x, long flag)" in gp,but I cannot ger any source code ! |
|
|
|
|
|
#6 | |
|
Feb 2006
Denmark
2×5×23 Posts |
Quote:
Code:
ispseudoprime(x,{n}): true(1) if x is a strong pseudoprime, false(0) if not.
If n is 0 or omitted, use BPSW test, otherwise use strong Rabin-Miller test
for n randomly chosen bases.
Code:
long
ispseudoprime(GEN x, long flag)
{
if (flag == 0) return BSW_psp(x);
return millerrabin(x, flag);
}
|
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AGM algorithms for ln(x) | ewmayer | Other Mathematical Topics | 17 | 2018-09-12 16:06 |
| CUDA algorithms | ET_ | GPU Computing | 14 | 2011-12-01 09:48 |
| Primality searches and primality successes | marco_calabresi | Information & Answers | 3 | 2009-04-17 19:44 |
| Quantum Algorithms? | ShiningArcanine | Lounge | 4 | 2007-12-16 12:11 |
| Implementing algorithms, did I do this right? | ShiningArcanine | Programming | 18 | 2005-12-29 21:47 |