![]() |
|
|
#1 |
|
Sep 2002
Database er0rr
72338 Posts |
Code:
? gettime();p=44497;N=2^p-1;q=(N-1)/p;lift(Mod(3,N)^N);gettime() 6132 Code:
? gettime();p=44497;N=2^p-1;q=(N-1)/p;lift(Mod(3,N)^q);gettime() 6125
|
|
|
|
|
|
#2 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
|
|
|
|
|
|
|
#3 |
|
Jun 2003
5,051 Posts |
Code:
gp > p=44497; gp > N=2^p-1; gp > q=(N-1)/p; gp > r=N+1; gp > # timer = 1 (on) gp > lift(Mod(3,N)^N); time = 18,095 ms. gp > lift(Mod(3,N)^q); time = 18,032 ms. gp > lift(Mod(3,N)^r); time = 17,986 ms. gp > |
|
|
|
|
|
#4 | |
|
Sep 2002
Database er0rr
3,739 Posts |
Quote:
The LL tests uses p-2 squarings and subtractions by 2 all mod 2^p-1. The test I give requires fewer squarings and some multiplications by 3 all mod 2^p-1. Last fiddled with by paulunderwood on 2016-02-06 at 13:51 |
|
|
|
|
|
|
#5 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
Last fiddled with by science_man_88 on 2016-02-06 at 13:57 |
|
|
|
|
|
|
#6 |
|
Sep 2002
Database er0rr
3,739 Posts |
Yes. All squarings. Pari maybe is not the best program to use to see the true differences.
|
|
|
|
|
|
#7 | |
|
Jun 2003
5,051 Posts |
Quote:
EDIT:- Not to mention the cost of computing q=(N-1)/p. Last fiddled with by axn on 2016-02-06 at 14:42 |
|
|
|
|
|
|
#8 | |
|
Sep 2002
Database er0rr
1110100110112 Posts |
Quote:
I coded it up by hacking Robert's script: Code:
myfermat(p)=mp=2^p-1;q=(mp-1)/p;res=3;len=length(binary(q));forstep(i=len-2,0,-1,res=sqr(res);hi=shift(res,-p);lo=bitand(res,mp);res=lo+hi;if(bittest(q,i),res*=3);while(res>=mp,res-=mp);while(res<0,res+=mp)) Code:
? gettime();myfermat(110503);gettime() time = 18,232 ms. 18232 ? gettime();mylucas(110503);gettime() time = 18,096 ms. 18096 |
|
|
|
|
|
|
#9 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
Code:
myfermat(p)=mp=2^p-1;q=mp\p;res=3;len=length(binary(q));forstep(i=len-2,0,-1,res=sqr(res);hi=res>>p;lo=bitand(res,mp);res=lo+hi;if(bittest(q,i),res*=3);while(res>=mp,res-=mp);while(res<0,res+=mp)) Last fiddled with by science_man_88 on 2016-02-06 at 15:12 |
|
|
|
|
|
|
#10 |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
okay I may have been testing with a virus scanner going that may explain things somewhat but I still get mine as faster with just chrome going. okay maybe I just think this is faster for some reason. never midn I quit I am never really helpful too many ways to play with codes.
Last fiddled with by science_man_88 on 2016-02-06 at 17:36 |
|
|
|
|
|
#11 | |
|
Sep 2002
Database er0rr
373910 Posts |
Quote:
|
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is it faster to run 1 worker or many? | arbiter21 | Information & Answers | 17 | 2016-02-05 05:04 |
| My CPU is getting faster and faster ;-) | lidocorc | Software | 2 | 2008-11-08 09:26 |
| 3-PRP faster than LL for GIMPS? | bearnol | Math | 35 | 2005-10-12 14:33 |
| Faster way to do LLT? | 1260 | Miscellaneous Math | 23 | 2005-09-04 07:12 |
| Faster than LL? | clowns789 | Miscellaneous Math | 3 | 2004-05-27 23:39 |