20120928, 14:46  #1 
"Juan Tutors"
Mar 2004
2^{4}·5·7 Posts 
P1 question
It's been a while since I fully read the way P1 test works so please forgive me if I get this wrong:
Suppose you do P1 test on M=M332######, with bounds B1=3015000 and B2=48240000. P1 stage 1 finds no factor, so the test starts P1 stage 2 processing 6 of 480 relative primes. From what I understand, stage 2 with those first 6 relative primes finds six numbers modulo , hoping for a residue of something not equal to 1. Is this correct? If this is correct, then the reason it starts processing the next 6 relative primes is because all those residues are 1, correct? Then, instead of starting the next six relative primes in stage 2 with the mod that it found in stage 1, isn't it better to arbitrarily pick one of the mods that was found in stage 2 with the first six relatively primes and use that one with the second six relative primes. Then, pick one of the mods from those second six relative primes and use that for the third six relative primes, etc? 
20120928, 15:11  #2  
Jun 2003
5×29×37 Posts 
Quote:
Now, you only know if P1 succeeded or not when you do a GCD. Since GCD is an expensive operation and chance of success is low, you're better off completing the whole stage 2 and doing the GCD. Quote:


20190803, 02:59  #3 
"Juan Tutors"
Mar 2004
2^{4}·5·7 Posts 
I am not a fan of resurrecting threads, but a similar thought came to me when I was selfstalking (back after 10 years ... wow I said some dumb stuff!) and thought that there might be an easytodo implementation of the initial idea, minus the misunderstood math.
So from my understanding from reading the GIMPS website, say E is the product of all primes less than B1. We calculate . If no factor is found, we go on to stage 2. My suggestion WAS for stage 2, if 6 of 480 relative primes are processed at a time. (Yes, I know that way more relative primes are tested nowadays. I'm back to the project after a decade off.) At the time, I thought one of the the 6 GCDs could be used, but of course it can't. But when I was thinking about it again, I realized that is so large that we must be using , which has the same GCD with Mp. If I'm wrong about that, stop reading here. So my idea actually holds now, in the age of nearinstantlywritable files on SSDs. My suggestion is, for any one of the 6 relative primes that are being used in this example, store the value of that number whose GCD you are taking mod Mp on the drive, before taking the GCD. Then, under the assumption that no factor was found, use that stored number in the next step with the next 6 relative primes. Save one of the new numbers, and keep doing that until the process is done. That way the B2 stage is actually done with not 1 prime between B1 and B2 at a time, but in this example, 1/6 of the primes between B1 and B2. The fraction today would be smaller because it's not 6 relative primes processed at a time, but it's not which is what it is now. I know that this is a slow process on a spinning drive, but on an SSD, this should be quite fast. The only added time is the time it takes to write the number to the drive and then pick up the number again. Am I understanding the process right? Feel free to burst my bubble, but I kinda like the idea. I feel like it can save a large number of tests. Last fiddled with by JuanTutors on 20190803 at 03:20 
20190803, 14:53  #4  
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest
3·5·433 Posts 
Quote:
q^{floor(log base q of B1)}, not just q^{1}. I think that's described as E is B1powersmooth, not merely B1smooth. That makes E a much larger number. 2 As I recall, in prime95 E is calculated ahead of the exponentiation only up to some million bits size, then if applicable the rest of E is computed along the way. 3 The mod Mp is applied many times along the way to keep the calculation of 3^{2Ep} "small" enough to be possible. Quote:
5 Number of relative primes per pass in stage 2 can range anywhere from 1, to all of them, depending on exponent and available RAM. There are also scenarios where it is not possible to run even 1. 6 Gcd's are expensive and run on one cpu core. 7 There's ONE gcd at the end of stage 1; ONE at the end of stage 2, in prime95 or CUDAPm1 or GpuOwl. 
