mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Miscellaneous Math

Reply
 
Thread Tools
Old 2010-07-23, 19:29   #232
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

168010 Posts
Default

Quote:
Ah. In that case "If b=x is present, it will perform a Miller-Rabin test using base x." is incorrect.
Is that why 1373653 returns as a prime when tested with b=2 or b=3, when the trial division settings are reduced to the point where it passes?

Code:
(15:30) gp > isSPRP(1373653, b=2)
time = 0 ms.
%290 = 1
(15:30) gp > isSPRP(1373653, b=3)
time = 0 ms.
%291 = 1
Another example:
Code:
(15:32) gp > isSPRP(390937, b=2)
time = 0 ms.
%300 = 1
(15:32) gp > isSPRP(390937, b=7)
time = 0 ms.
%301 = 0
So, why does 390937 pass for b=2 and fail for b=7? Please, enlighten me with your brilliant explanation.
Now that both of those objections are entirely debunked, continuing on with regularly scheduled programming, so to speak.

Last fiddled with by 3.14159 on 2010-07-23 at 19:37
3.14159 is offline   Reply With Quote
Old 2010-07-23, 19:40   #233
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
So, why does 390937 pass for b=2 and fail for b=7? Please, enlighten me with your brilliant explanation.
Would you post your code?
CRGreathouse is offline   Reply With Quote
Old 2010-07-23, 19:44   #234
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

110100100002 Posts
Default

Quote:
Would you post your code?
It's the code you posted earlier, except b=random(n)

Code:
isSPRP(n, b=random(n)) = {
forprime(p=2,nextprime(10^6),
if(n%p==0,return(p))
);
my(s=valuation(n-1,2),d=n>>s);
n = Mod(b, n)^d;
if (n == 1, return(n));
while(s--,
if (n == -1, return(n));
n = n^2;
);
n == -1
};

Last fiddled with by 3.14159 on 2010-07-23 at 19:49
3.14159 is offline   Reply With Quote
Old 2010-07-23, 19:50   #235
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
It's the code you posted earlier, except b=random(n)
In the declaration? (I thought you put it in the Mod() statement, in which case it worked as I described... thus my request for code rather than description.) That's amusing... somewhat inadvisable in general, but it works in this case. Yes, in that case the only problems I have with the documentation is that it doesn't explain return values, and the only problems I have with the code are its inconsistent returns types* and the fact that it may test base 0 or 1. I'm not worried about the latter, though, as long as you use the code only for large numbers.

Last fiddled with by CRGreathouse on 2010-07-23 at 19:57
CRGreathouse is offline   Reply With Quote
Old 2010-07-23, 19:55   #236
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
In the declaration? (I thought you put it in the Mod() statement, in which case it worked as I described... thus my request for code rather than description.)
I would probably mess up the syntax if that were the case.

Quote:
That's amusing... somewhat inadvisable in general, but it works in this case.
At least it won't give a consistent list of pseudoprimes that passes.

Quote:
Yes, in that case the only problems I have with the documentation is that it doesn't explain return values, and the only problems I have with the code are its inconsistent returns types and the fact that it may test base 0 or 1.
Return values are self-explanatory anyway! And: It only takes one composite return to declare the number a proven composite. I modified the returns back to the default 1 and 0, 1 meaning prime, 0 meaning composite.

Also: A lucky find without any modifications: Largest keyjabbed prime I've found: 7242389437701561147346511132232465821 (Passed b= 2, and 5 randoms.)
+5 for a keyjabbed prime, +5 for a prime number of digits (37)

Last fiddled with by 3.14159 on 2010-07-23 at 19:58
3.14159 is offline   Reply With Quote
Old 2010-07-23, 20:00   #237
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Return values are self-explanatory anyway!
It's not self-explanatory to me! The script returns the smallest prime factor of n, if n has a prime factor below 1000033; Mod(1, 1), if n is 1; an error, if n is less than 1; 1, Mod(1, n), or Mod(n-1, n) if none of the preceding apply but n is a base-b probable-prime; 0, if n is a proven composite without known factors.

Quote:
Originally Posted by 3.14159 View Post
I modified the returns back to the default 1 and 0, 1 meaning prime, 0 meaning composite.
Ah, much better. Now you can use it in an if statement without trouble.

Quote:
Originally Posted by 3.14159 View Post
Also: A lucky find without any modifications: Largest keyjabbed prime I've found: 7242389437701561147346511132232465821 (Passed b= 2, 3, 5, 7, 11, 13, 17)
Nice. You can certify primality, if you like, with isprime(N, 1).

Last fiddled with by CRGreathouse on 2010-07-23 at 20:00
CRGreathouse is offline   Reply With Quote
Old 2010-07-23, 20:07   #238
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
It's not self-explanatory to me! The script returns the smallest prime factor of n, if n has a prime factor below 1000033; Mod(1, 1), if n is 1; an error, if n is less than 1; 1, Mod(1, n), or Mod(n-1, n) if none of the preceding apply but n is a base-b probable-prime; 0, if n is a proven composite without known factors.
See above for clarification. Also: 1000003, which means it any composite number up to nextprime(1000003)^2 will fail TD. And, now that the return values are at default settings: It's self-explanatory.

Quote:
Ah, much better. Now you can use it in an if statement without trouble.
Excellent.

Quote:
Nice. You can certify primality, if you like, with isprime(N, 1).
I certified it using APRT-CL on Alpertron's app. Also:.. A curious question: What test does isprime use? (When there is no flag indicating the use of Pocklington or APR-CL)

Last fiddled with by 3.14159 on 2010-07-23 at 20:24
3.14159 is offline   Reply With Quote
Old 2010-07-23, 20:34   #239
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

If the number is small enough to fit into one machine word, it does a special test. If not:

1. Trial divide to 101 (efficiently, not one-at-a-time)
2. Performs a BPSW test (base-2 strong test followed by a Lucas test)
3. If n is less than 10^15, return true (actually, 10^16 would work)
4. Attempt to factor n-1
5. If sufficiently smooth, do a Selfridge n-1 test
6. If almost smooth enough, augment a Selfridge n-1 test with the Brillhart-Lehmer-Selfridge test
7. Otherwise, fall back to APRCL.
CRGreathouse is offline   Reply With Quote
Old 2010-07-23, 21:13   #240
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Extended my prime search for Proth-GFNs to 150000 for k's range. Also, increased sieving by a factor of 4. This left 1/14 of the candidates.

A curious question: For WinPFGW, there's a bunch of settings like that of its predecessor, PrimeForm. However, they are inaccessible. Why add options such as this, knowing that they are useless because they cannot be accessed?

Last fiddled with by 3.14159 on 2010-07-23 at 21:34
3.14159 is offline   Reply With Quote
Old 2010-07-23, 21:49   #241
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
I certified it using APRT-CL on Alpertron's app. Also:.. A curious question: What test does isprime use? (When there is no flag indicating the use of Pocklington or APR-CL)
straight from the program help:

isprime(x,{flag=0}): true(1) if x is a (proven) prime number, false(0) if not. If flag is 0 or omitted, use a combination of algorithms. If flag is 1, the
primality is certified by the Pocklington-Lehmer Test. If flag is 2, the primality is certified using the APRCL test.
science_man_88 is offline   Reply With Quote
Old 2010-07-23, 23:21   #242
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Update: Prime found! 10462 * 12968192 + 1 is a probable prime! (Proth-GFN.) (Validating w/SPRP for random base. Might take 5-10 mins. Used base 2 to speed it up.)
This is simply excellent. A PRP25503.

Also: Passed base 2 SPRP test as well. (How seriously should one take PFGW's PRP result?)

Hmm: Something interesting about hyperfactorials: k * hyperfactorial(a)^n + 1 cannot be prime when a is odd and when n is divisible by 2. Let's try even a; n is odd.
Conjecture debunked: 1286 * hyperfactorial(8)^3 + 1 is prime.

Next conjecture: It applies to all odd integers only?
Debunked: 348 * hyperfactorial(9)^4 + 1 is prime; 261 * hyperfactorial(9)^6 + 1 is prime.
Next: Applies to odd primes:
Debunked: 811 * hyperfactorial(13)^4 + 1 is prime.
Surprisingly, I found that all cases were composites when I tested a = 11. Pseudo-sierpinski number, anyone?

Last fiddled with by 3.14159 on 2010-07-24 at 00:17
3.14159 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wheel Factorization a1call Factoring 11 2017-06-19 14:04
Efficient Test paulunderwood Computer Science & Computational Number Theory 5 2017-06-09 14:02
LL tests more credit-efficient than P-1? ixfd64 Software 3 2011-02-20 16:24
A Wheel storm5510 Puzzles 7 2010-06-25 10:29
Most efficient way to LL hj47 Software 11 2009-01-29 00:45

All times are UTC. The time now is 22:43.


Fri Aug 6 22:43:10 UTC 2021 up 14 days, 17:12, 1 user, load averages: 5.09, 4.25, 3.78

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.