mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > Factoring

Reply
 
Thread Tools
Old 2008-11-18, 12:09   #1
aaa120
 
Oct 2008

24 Posts
Default algorithms about primality in pari/gp

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
aaa120 is offline   Reply With Quote
Old 2008-11-18, 13:53   #2
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

1101110101012 Posts
Default

Next time, try this before asking...
jasonp is offline   Reply With Quote
Old 2008-11-18, 15:31   #3
Jens K Andersen
 
Jens K Andersen's Avatar
 
Feb 2006
Denmark

23010 Posts
Default

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);
}
Jens K Andersen is offline   Reply With Quote
Old 2008-11-21, 10:27   #4
aaa120
 
Oct 2008

24 Posts
Default I cannot understand

Quote:
Originally Posted by Jens K Andersen View Post
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);
}
My native language is not English ,I cannot understand your words
very well.
aaa120 is offline   Reply With Quote
Old 2008-11-21, 10:36   #5
aaa120
 
Oct 2008

100002 Posts
Default

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 !
aaa120 is offline   Reply With Quote
Old 2008-11-21, 17:36   #6
Jens K Andersen
 
Jens K Andersen's Avatar
 
Feb 2006
Denmark

2·5·23 Posts
Default

Quote:
Originally Posted by aaa120 View Post
I have installed pari/gp and type" long
ispseudoprime(GEN x, long flag)" in gp,but I cannot ger any source code !
You can type a question mark before a function name to get a short description of that function. Typing "?ispseudoprime" outputs:
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.
The source code is not output by a question mark. I downloaded the source code and manually inspected it to find this:
Code:
long
ispseudoprime(GEN x, long flag)
{
  if (flag == 0) return BSW_psp(x);
  return millerrabin(x, flag);
}
Jens K Andersen is offline   Reply With Quote
Reply



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

All times are UTC. The time now is 20:09.


Fri Jul 16 20:09:31 UTC 2021 up 49 days, 17:56, 1 user, load averages: 2.19, 2.29, 2.27

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.