![]() |
|
|
#12 |
|
"Mihai Preda"
Apr 2015
3×457 Posts |
OK. So I have res512(e) == f(p,e)%(2^512).
Now, if I choose res64 to be the *top* 64 bits of the res512 instead of the bottom 64 bits, when I do the mul-by-3 to derive f(p, e+1), the addition of "c" (being 0, 1, or 2) to 3*f(p,e) is very unlikely to change the top 64 bits of the 512 bits. 1/(2^(512-64))-likely. So practically, the "c" does not influence the top 64 bits of res512 in a mul-by-3 step. In a div-by-3, probably the carry moves the other way around, and thus the bottom "64" bits are unlikely to be affected. Putting the 64 bits in the middle of the 512 bits, we can do both mul and div-by-3 disregarding "c". Last fiddled with by preda on 2018-06-27 at 10:50 |
|
|
|
|
|
#13 | ||
|
"Robert Gerbicz"
Oct 2005
Hungary
22·7·53 Posts |
Quote:
Quote:
Code:
(18:55) gp > binary(lift(Mod(1,2^512)/3)) %39 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1] (18:55) gp > And there could be some misunderstanding here, because the mult by 3 comes from the f(p,e) to f(p,e+1) step, and the division coming from the reverse direction, when we know f(p,e+1) and we want to get f(p,e). So from what residue you'd get at once the mult by 3 and div by 3 ? |
||
|
|
|
|
|
#14 |
|
"Mihai Preda"
Apr 2015
3·457 Posts |
Concretely, I was thinking that when moving to a much larger residue, such as res512, we should take from the full Mp bits:
res512 := bits[Mp-256:Mp-1] + bits[0:255] instead of bits[0:511]. Would such a setup of res512 be a problem for your algorithm? |
|
|
|
|
|
#15 |
|
Jun 2003
5,051 Posts |
|
|
|
|
|
|
#16 |
|
Jun 2003
5,051 Posts |
IIUC, the more excess bits you have, the less likely a false positive will happen. Sure, 512 is good enough for today's purpose, but the additional cost of moving directly to 1024 is negligible, and will avoid future changes and other complications. Anyway, just something to think about for TPTB.
|
|
|
|
|
|
#17 | |
|
"Mihai Preda"
Apr 2015
3×457 Posts |
Quote:
For LL, the "-2" applied at the 0 position makes that position special. But nothing makes bit-0 particular for PRP; it's a "perfect circle" with all bit positions equivalent. Last fiddled with by preda on 2018-06-28 at 08:12 |
|
|
|
|
|
|
#18 | ||
|
"Robert Gerbicz"
Oct 2005
Hungary
101110011002 Posts |
Quote:
Code:
(14:21) gp > p=20011;mp=2^p-1;x=random(mp); (14:21) gp > x2=Mod(x^2,mp); (14:21) gp > y=x+(1-2*bittest(x,64))*2^64; (14:21) gp > y2=Mod(y^2,mp); (14:21) gp > vecsum(binary(bitxor(lift(x2),lift(y2)))) %32 = 10075 (14:21) gp > y-x %33 = 18446744073709551616 (14:21) gp > Quote:
|
||
|
|
|
|
|
#19 |
|
"Mihai Preda"
Apr 2015
3×457 Posts |
|
|
|
|
|
|
#20 |
|
"Robert Gerbicz"
Oct 2005
Hungary
22×7×53 Posts |
|
|
|
|
|
|
#21 |
|
"Mihai Preda"
Apr 2015
3·457 Posts |
OK. Maybe the residue must be taken at 0.
Anyway, cool idea! How much work do you estimate would be saved? If I understand correctly, the benefit kicks in when a single factor "d" of Mp is known, and Mp has at least one other factor. (i.e. Mp/d is composite). If Mp/d is prime, is an additional PRP test still needed to "prove" it? What if two factors d1 and d2 of Mp are known. Is a PRP test needed to decide Mp/d1/d2? Last fiddled with by preda on 2018-06-29 at 14:11 |
|
|
|
|
|
#22 |
|
Jun 2003
5,051 Posts |
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Daylight Saving Time | davieddy | Lounge | 27 | 2015-02-26 18:45 |
| Prime95 NOT Saving!!! | Primeinator | Information & Answers | 9 | 2008-09-22 19:00 |
| Not Saving | BioRules | Information & Answers | 9 | 2008-05-31 13:52 |
| Saving computation in ECM | dave_dm | Factoring | 8 | 2004-06-12 14:18 |
| saving over a network | crash893 | Software | 11 | 2004-05-06 14:15 |