mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Miscellaneous Math

Reply
 
Thread Tools
Old 2010-07-23, 17:50   #221
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
How did you get nearly 4, if the odds are 1 in 58720 ? As of this post, I've tested up to 2223 * 12968192+1
Because the odds aren't 1 in 58720, they vary from as good as 1 in 19173 for k = 5 to as poor as 1 in 50035 for k = 69984. (Actually, these are slightly high because of other primes I didn't include... if you work only mod 6, the expected number is 3.57.)

Last fiddled with by CRGreathouse on 2010-07-23 at 18:03
CRGreathouse is offline   Reply With Quote
Old 2010-07-23, 17:52   #222
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

2×5,393 Posts
Default

Quote:
Originally Posted by retina View Post
But it doesn't depend upon how long you want to keep data secure. The OP said that a 1024 key "might be factored soon enough". So estimating the amount of effort required to do that is entirely appropriate. It doesn't require any additional qualification based upon what the key is protecting.
Actually, it depends very much on how long you want to keep data secure. It also depends on the value of the data to you and to your opponents.

For instance, if I want to keep something secure from you until tomorrow a 512-bit key is easily adequate. If I want to keep it secure for twenty years from the likes of me, a 1024-bit key is probably inadequate.

"Soon enough" is very context-dependent.

Paul
xilman is offline   Reply With Quote
Old 2010-07-23, 17:52   #223
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Because the odds aren't 1 in 58720, they vary from as good as 1 in 19173 for k = 5 to as poor as 1 in 50035 for k = 69984.
I made my estimate based on 1/log(x): So I simply did: 1/log(70000 * 12968192 + 1), which was about 1 in 58720.

Also: Making a (nextSPRP(n)) function, to compare it to the (nextprime(n)) function.

Last fiddled with by 3.14159 on 2010-07-23 at 18:09
3.14159 is offline   Reply With Quote
Old 2010-07-23, 18:04   #224
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
I made my estimate based on 1/log(x): So I simply did: 1/log(70000 * 12968192 + 1), which was about 1 in 58720.
I used a more sophisticated estimate. I originally said around 4, but the truth is probably closer to 3.5; I'll need to check more carefully to get good results.
CRGreathouse is offline   Reply With Quote
Old 2010-07-23, 18:26   #225
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Added a help option to the isSPRP test:
"A pseudoprimality test which employs trial division to 1000003, then performs a Miller-Rabin primality test using a random base between 1 and n, if b=x is omitted. If b=x is present, it will perform a Miller-Rabin test using base x."

Last fiddled with by 3.14159 on 2010-07-23 at 18:28
3.14159 is offline   Reply With Quote
Old 2010-07-23, 18:43   #226
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Added a help option to the isSPRP test:
"A pseudoprimality test which employs trial division to 1000003, then performs a Miller-Rabin primality test using a random base between 1 and n, if b=x is omitted. If b=x is present, it will perform a Miller-Rabin test using base x."
That refers to this code?

Code:
isSPRP(n,b=2) = {
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
};
You should, at the least, explain what the return values mean in the help entry. Also, "then performs a Miller-Rabin primality test using a random base between 1 and n, if b=x is omitted" is false for the above code.
CRGreathouse is offline   Reply With Quote
Old 2010-07-23, 18:47   #227
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
You should, at the least, explain what the return values mean in the help entry. Also, "then performs a Miller-Rabin primality test using a random base between 1 and n, if b=x is omitted" is false for the above code.
As I posted earlier on, I changed it to (random(n)), which means it now uses random bases.

Last fiddled with by 3.14159 on 2010-07-23 at 18:51
3.14159 is offline   Reply With Quote
Old 2010-07-23, 18:48   #228
axn
 
axn's Avatar
 
Jun 2003

5,087 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
I made my estimate based on 1/log(x): So I simply did: 1/log(70000 * 12968192 + 1), which was about 1 in 58720
Since you're only considering odd integers, you can immediately double that estimation. So 1 in 29000. Then consider the fact that no factor of 1296 can be a factor of the number. This rules out 3 as a factor. So you can multiply the probability estimate by another 1.5. So 1 in 20000. That should be "good enough for government purposes".
axn is offline   Reply With Quote
Old 2010-07-23, 18:52   #229
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Since you're only considering odd integers, you can immediately double that estimation. So 1 in 29000. Then consider the fact that no factor of 1296 can be a factor of the number. This rules out 3 as a factor. So you can multiply the probability estimate by another 1.5. So 1 in 20000. That should be "good enough for government purposes".
Well, that bumps the amount of primes I'll find to at most three or four. 1/58720 * 2 = 1/29360
1/29360 * 1.5 = 1/19573. Surprisingly, just as CRG guessed earlier on.

Last fiddled with by 3.14159 on 2010-07-23 at 18:54
3.14159 is offline   Reply With Quote
Old 2010-07-23, 19:21   #230
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

175B16 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
As I posted earlier on, I changed it to (random(n)), which means it now uses random bases.
Ah. In that case "If b=x is present, it will perform a Miller-Rabin test using base x." is incorrect.

(Very minor point: you shouldn't really allow bases 0 or 1.)

Last fiddled with by CRGreathouse on 2010-07-23 at 19:24
CRGreathouse is offline   Reply With Quote
Old 2010-07-23, 19:22   #231
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Cool

Quote:
Originally Posted by 3.14159 View Post
Well, that bumps the amount of primes I'll find to at most three or four. 1/58720 * 2 = 1/29360
1/29360 * 1.5 = 1/19573. Surprisingly, just as CRG guessed earlier on.
If you look at the code I posted, I take into account 2, 3, and up to four other primes. So it should be no surprise....

I also took into account smaller factors, like adding the constant 1 to the log and using the actual k values rather than just 7000; these only increase the denominator by ~9 in the extreme case, though, so not a big deal.

Last fiddled with by CRGreathouse on 2010-07-23 at 19:24
CRGreathouse is offline   Reply With Quote
Reply



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:03.


Fri Aug 6 22:03:22 UTC 2021 up 14 days, 16:32, 1 user, load averages: 2.93, 2.80, 2.70

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.