![]() |
|
|
#12 |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
|
|
|
|
|
|
#13 | |
|
∂2ω=0
Sep 2002
República de California
19×613 Posts |
Quote:
If OTOH by 'fast' you mean 'speed of coding it up', then you got us beat, hands-down. (But only if you neglect the coding time others put into the bignum package you are using.) |
|
|
|
|
|
|
#14 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
Last fiddled with by science_man_88 on 2016-01-02 at 12:55 |
|
|
|
|
|
|
#15 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
I've thought about the fact that in the squaring version if
Last fiddled with by science_man_88 on 2016-01-02 at 15:53 |
|
|
|
|
|
#16 |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
Here's another crappy version:
Code:
LL(p)=my(s=Mod(2,2^p-1));for(x=1,p-2,s=vecprod([2,s-1,s+1])+1);s |
|
|
|
|
|
#17 |
|
∂2ω=0
Sep 2002
República de California
265778 Posts |
Crappy-performing but functional bc code:
Code:
define lltest(p) {
auto i,m,r; i = p-2; m = 2^p-1; r = 4;
while(i--) {
r = (r^2-2)%m;
}
return(r==0);
}
|
|
|
|
|
|
#18 |
|
Sep 2002
Database er0rr
376210 Posts |
In Ruby....
Code:
def LL(p)
s, n = 4, 2**p-1
3.upto(p) { s=(s**2-2)%n }
s==0
end
print "LL exponent : "
p = gets.to_i
puts LL(p)
Last fiddled with by paulunderwood on 2018-08-22 at 22:18 |
|
|
|
|
|
#19 |
|
Sep 2003
50318 Posts |
Earlier in the thread someone mentioned the Rosetta Code page, with dozens of languages. None particularly efficient, though.
http://rosettacode.org/wiki/Lucas-Lehmer_test |
|
|
|
|
|
#20 | |
|
Sep 2002
Database er0rr
2×32×11×19 Posts |
Quote:
I guess the linked page is too small for George's source
Last fiddled with by paulunderwood on 2018-08-22 at 22:52 |
|
|
|
|
|
|
#21 |
|
∂2ω=0
Sep 2002
República de California
19×613 Posts |
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| The Joys of Cracked.com: 5 Ways We Ruined the Occupy Wall Street Generation | Dubslow | Soap Box | 17 | 2012-05-14 08:51 |
| RDS's unique pedagogic ways | R.D. Silverman | Soap Box | 137 | 2012-01-07 07:52 |
| ways to get rid of oil spills | science_man_88 | Puzzles | 9 | 2010-07-30 21:22 |
| Help needed to test Athlon64 code | geoff | Programming | 7 | 2006-08-18 12:16 |
| Creative ways to achieve Athlon 64 / Opteron optimization | GP2 | Hardware | 11 | 2004-01-21 03:01 |