![]() |
|
|
#221 |
|
Aug 2006
3×1,993 Posts |
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 |
|
|
|
|
|
#222 | |
|
Bamboozled!
"πΊππ·π·π"
May 2003
Down not across
2A2216 Posts |
Quote:
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 |
|
|
|
|
|
|
#223 | |
|
May 2010
Prime hunting commission.
24×3×5×7 Posts |
Quote:
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 |
|
|
|
|
|
|
#224 |
|
Aug 2006
3×1,993 Posts |
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.
|
|
|
|
|
|
#225 |
|
May 2010
Prime hunting commission.
110100100002 Posts |
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 |
|
|
|
|
|
#226 | |
|
Aug 2006
135338 Posts |
Quote:
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
};
|
|
|
|
|
|
|
#227 | |
|
May 2010
Prime hunting commission.
24·3·5·7 Posts |
Quote:
Last fiddled with by 3.14159 on 2010-07-23 at 18:51 |
|
|
|
|
|
|
#228 |
|
Jun 2003
5,087 Posts |
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".
|
|
|
|
|
|
#229 | |
|
May 2010
Prime hunting commission.
32208 Posts |
Quote:
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 |
|
|
|
|
|
|
#230 | |
|
Aug 2006
3×1,993 Posts |
Quote:
(Very minor point: you shouldn't really allow bases 0 or 1.) Last fiddled with by CRGreathouse on 2010-07-23 at 19:24 |
|
|
|
|
|
|
#231 | |
|
Aug 2006
175B16 Posts |
Quote:
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 |
|
|
|
|
![]() |
| 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 |