![]() |
|
|
#56 |
|
"Mihai Preda"
Apr 2015
3·457 Posts |
Having to re-do the P-1 first-stage for double checking is a hit. (Note that the PRP-1 could be double-checked without redoing the P-1 by saving the Base bits, and starting the double check from there. Even if Base is "wrong" or "random" (e.g. there was an error, undetected, in the P-1-first-stage), the PRP(Base) is still valid and can be double checked).
|
|
|
|
|
|
#57 | |
|
"Mihai Preda"
Apr 2015
3·457 Posts |
Quote:
In my analysis I took the cost of one MUL (general multiplication) as being 2x the cost of a Squring. (because on the GPU, in my implementation, the MUL is that slow). (I approximated the cost of one GCD with 2000 Squarings). I still think doing some PRP-1 may be worth, at least to explore the empiric performance (i.e. what factors it finds, and frequencies). I also don't know the probabilities for finding factors, so I use lower bounds coming from P-1(B1, B2). I don't have experience with implementing second-stage of P-1. Could somebody enlighten me WRT the cost of second-stage, as a function of B2? |
|
|
|
|
|
|
#58 |
|
Jun 2003
117328 Posts |
Excluding some setup costs, it is one subtraction and one multiplication per pair of primes. Sometimes a given prime cannot be paired; in that case, one subtraction/multiplication for a single prime. (No idea what % of primes can be paired). This of for all primes B1 < p <= B2.
|
|
|
|
|
|
#59 | |
|
"Mihai Preda"
Apr 2015
3×457 Posts |
Quote:
|
|
|
|
|
|
|
#60 | ||
|
"Ben"
Feb 2007
3,517 Posts |
Quote:
Quote:
|
||
|
|
|
|
|
#61 | |
|
"Mihai Preda"
Apr 2015
55B16 Posts |
OK. So comparing the number of multiplication,
in PRP-1 one multiplication in average covers about 2.5 "useful" primes and 2 more "large" primes. So from this aspect PRP-1 looks more efficient than second-stage P-1. OTOH, PRP-1 also does interleaving PRP steps that are not needed (wasted) if a factor is found. It's true that if a factor is found, chances are it's found early in the PRP-1 so there's not so much wastage. Other small advantages of PRP-1: low memory usage, and much simpler to implement (compared to second-stage P-1). Also the iteration values that are accumulated towards the GCD are error-checked with the GEC (but not the multiplication itself). Thus a bit better error-resistance. Quote:
|
|
|
|
|
|
|
#62 |
|
"Mihai Preda"
Apr 2015
3×457 Posts |
I realize I have only a small understanding of the prime factors of 2^k - 1:
1. (a sufficient condition): if z(p) | k, then p | (2^k - 1) 2. in general, 2^k - 1 has "many factors, thus mostly small factors". But the condition 1 above is not necessary, meaning there are p such that p|(2^k - 1), yet z(p) does-not-divide k. For example, I wonder what is the factor coverage of 2^k - 1, for k=0..N. Let's say, given N, what is the smallest prime p that is not a factor of any 2^k - 1, for k in [0, N]. (maybe a probabilistic argument would help here). Another way to put it, what's the smallest p that does not divide product(2^k - 1, for k =0..N) And how does such "smallest p" grow with N? PS: sure, I mean "odd prime" p. (excluding 2, which is never a factor of 2^k - 1) Last fiddled with by preda on 2018-09-26 at 00:47 |
|
|
|
|
|
#63 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
|
|
|
|
|
|
#64 |
|
"Mihai Preda"
Apr 2015
3×457 Posts |
Either. Take every value in the interval [0, N].
Last fiddled with by preda on 2018-09-26 at 01:11 |
|
|
|
|
|
#65 | ||
|
Jun 2003
13DA16 Posts |
Quote:
EDIT:- Ok, from up thread Quote:
Last fiddled with by axn on 2018-09-26 at 03:35 |
||
|
|
|
|
|
#66 | |
|
"Mihai Preda"
Apr 2015
55B16 Posts |
for p == 1583 423452 213582 178911 805893 942695 192421,
I imagine z(p) does not divide 1620, yet p divides 2^1620 - 1 Quote:
|
|
|
|
|