![]() |
|
|
#210 | |
|
"Robert Gerbicz"
Oct 2005
Hungary
2·743 Posts |
Quote:
or you can divide it by "a", if you want that: a^(N-1)==a^(d-1) mod (N/d). Ofcourse this 2 are equivalent forms since in all these cases gcd(a,N)=1. Btw in some cases even if only the truncated RES64 kept, say in 1 and 3 we can do a quick comparison that decides with high probability if these are the same (so would be the same for the same exponent): Let r1 and r2 the two RES64 remainders where these comes from the exponents differing by one: r1=(a^e mod N) mod (2^64) r2=(a^(e+1) mod N) mod (2^64) then r2==a*r1-i*N mod (2^64) for some 0<=i<a. if the difference is 2 between the exponents, then r3==a^2*r1-i*N mod (2^64) and 0<=i<a^2 is the range for "i" etc. In other words there are only at most 9 different possible values for r3=(a^(e+2) mod N) mod (2^64) if you know r1 and a=3. It was a small trick, but good to know. Last fiddled with by R. Gerbicz on 2017-09-22 at 20:35 Reason: small typos |
|
|
|
|
|
|
#211 | |||
|
Jun 2003
2·3·7·112 Posts |
Quote:
Quote:
Quote:
But assume that this will not be done. Are you saying that you'll build the intelligence into P95 so that if the final save file is available (calculated using method 5), and a new test with additional factor is done, it will do the short circuit evaluation? Last fiddled with by axn on 2017-09-23 at 02:06 Reason: quote |
|||
|
|
|
|
|
#212 | |
|
Jun 2003
2×3×7×112 Posts |
Quote:
|
|
|
|
|
|
|
#213 | ||
|
P90 years forever!
Aug 2002
Yeehaw, FL
7,537 Posts |
Quote:
Quote:
|
||
|
|
|
|
|
#214 | ||
|
"Robert Gerbicz"
Oct 2005
Hungary
5CE16 Posts |
Quote:
Quote:
For k!=1 there is some change in the test: we test N=k*2^n+c (fixed b=2). Code:
u0=a^k mod N u[i]=u0^(2^i) mod N d[t]=prod(i=0,t,u[L*i]) mod N d[t]=d[t-1]*u[L*t] mod N d[t]=u0*d[t-1]^(2^L) mod N (to do the error check) the main change that at the error check we multiple by a general number, u0. This is not a timing issue, as we would do probably even less than 50 error checks at the main wavefront of Riesel/Sierpinski numbers (more checks for Mersenne/Fermat numbers, but there u0=3 smallish). So the slowdown is less than 1 sec. per test. Save in file u0 or recompute(?) it at each restart, not an issue since k is small. Also a change that there is absolutely no error checks while you don't get u0=a^k mod N. Ofcourse as mentioned in some cases you have to do some mults at interim file save to get the Fermat Prp interim residue because the top i bits of N=k*2^n+c could be different from the top i bit of k*2^n. This also means that you should need to do some mults to get back to the error check's algorithm's u[i]=u0^(2^i) mod N residue if you have an interim file save's Fermat prp residue. The error check's algorithm is doing n iterations: iteration=0 to iteration=n the final residue is u[n]=u0^(2^n) mod N, and this iteration count is independent from k and c. An alternative way to handle this is that to delay the k-th powermod to the end, and before at each interim file save do a k-th powermod, but in this case you have to save also the original residue(!) to be able to continue the algorithm at restart (doing k-th root is hard). |
||
|
|
|
|
|
#215 |
|
"Robert Gerbicz"
Oct 2005
Hungary
101110011102 Posts |
For Proth numbers if you stop at iteration=n-1 at the error check algorithm then you have the Proth test (if you would go further then you are in the weaker Fermat test).
|
|
|
|
|
|
#216 | |
|
P90 years forever!
Aug 2002
Yeehaw, FL
753710 Posts |
Yes, Primenet assumes the client is smart. Both gpuOwl and prime95 default to base=3.
Quote:
Note this mul by a^-1 is not done for interim save files. These save files are not meant to be portable, so I just save whatever I need for a quick restart. BTW, thank you for the error-checking idea, clear explanations, and development feedback. Job well done! |
|
|
|
|
|
|
#217 | |
|
"Mihai Preda"
Apr 2015
3·457 Posts |
Quote:
OTOH for the final residue, I can trivially change from type-4 to type-3 if that's preferred, and probably without too much trouble change to type-1 (by doing a "div-by-9" from type-3). So, I'm going to submit the existing gpuOwl residues as type-4, and consider switching in the future to type-3 or type-1. But I don't see enough reason to "massage" the intermediate residues to change their format yet. |
|
|
|
|
|
|
#218 | |
|
"Robert Gerbicz"
Oct 2005
Hungary
2×743 Posts |
Quote:
r=x mod d s=N mod d then x/d==(x+k*N)/d mod N for k==(-r/s) mod d and there is an exact(!) division here: d divides x+k*N the idea behind this was to get the good k multiplier: k is good iff x+k*N==0 mod d, so k==-x/N==-r/s mod d. |
|
|
|
|
|
|
#219 | |
|
Jun 2003
117328 Posts |
Quote:
|
|
|
|
|
|
|
#220 | |
|
Sep 2003
1010000110012 Posts |
Quote:
I think once you submit a truncated (64-bit or whatever) residue of a given type, and throw away the remaining bits, it's no longer possible to convert that truncated residue from one type to another, no? And for the sake of being able to double-check residues in the database that were returned by different programs, what matters is simply that the 64-bit hex strings match, regardless of how they were calculated. So switching from one type to another in the future would be quite problematic, and it would be quite important for all software authors to agree on a type, right from the start. Or am I missing something? |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mfakto: an OpenCL program for Mersenne prefactoring | Bdot | GPU Computing | 1676 | 2021-06-30 21:23 |
| GPUOWL AMD Windows OpenCL issues | xx005fs | GpuOwl | 0 | 2019-07-26 21:37 |
| Testing an expression for primality | 1260 | Software | 17 | 2015-08-28 01:35 |
| Testing Mersenne cofactors for primality? | CRGreathouse | Computer Science & Computational Number Theory | 18 | 2013-06-08 19:12 |
| Primality-testing program with multiple types of moduli (PFGW-related) | Unregistered | Information & Answers | 4 | 2006-10-04 22:38 |