![]() |
|
|
#45 |
|
Aug 2018
GEORGIA Republic
111002 Posts |
1. about your code: I just put main LL algo, instead of some 'modpow optimization'
2. back to sqrt. I looked in debugger, and Perl's BigInt library is a GMP. And code executing was some written in MMX registers, possible name 'basecase_sqr', but from one glance, nothing like simple loops of MUL. need more info on that code. |
|
|
|
|
|
#46 |
|
Aug 2018
GEORGIA Republic
22×7 Posts |
Hi! I become interested and downloaded it, but some strange happens, 10^390625 is same, as (10^390625)^2 ; does [+++] means "more digits there"? this just overflows 10^390625^2. Last fiddled with by ktpn2011 on 2018-08-07 at 11:14 |
|
|
|
|
|
#47 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
|
|
|
|
|
|
#48 |
|
Aug 2018
GEORGIA Republic
22×7 Posts |
|
|
|
|
|
|
#49 |
|
Aug 2018
GEORGIA Republic
2810 Posts |
got near
x=10^(390625*16); writebin ("outfile", x) but not only number is inside, some other info Last fiddled with by ktpn2011 on 2018-08-07 at 12:26 |
|
|
|
|
|
#50 | |
|
Aug 2006
135338 Posts |
Quote:
Most directly you could do Code:
binary(greatBigNumber) |
|
|
|
|
|
|
#52 |
|
"Dana Jacobsen"
Feb 2011
Bangkok, TH
22×227 Posts |
Regarding the Perl,
There are lots of little things one could do outside the powmod to be either cleaner or faster, but it is really irrelevent for this purpose. Perl has multiple bigint backends, from the gawdawful-slow-but-super-portable pure Perl, old Pari, or GMP. Kriesel's script asks specifically for GMP though doesn't it will just whine and keep running if it isn't available. Using the Math::BigInt front end has a lot of overhead for each operation. Math::GMPz is less portable (in that you *have* to have GMP) and more brittle for coding (get a type wrong and it barfs nastily), but has almost no overhead. Much more similar timings to using C+GMP. Even so, for 86243 it is only about 15% slower than C+GMP using the same method (three step mul/pow, sub, mod). But it is about 5x slower than when we use the efficient mod for 2^p-1. E.g. Code:
time perl -E 'use ntheory; say Math::Prime::Util::GMP::is_mersenne_prime(86243)' 1 user 0m11.391s |
|
|
|
|
|
#53 | |
|
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest
124528 Posts |
Quote:
That form of time is linux-specific; https://www.lifewire.com/command-ret...ommand-4054237 The following errors on windows 7; perl -E 'use ntheory; say Math::Prime::Util::GMP::is_mersenne_prime(86243);' Code:
Can't find string terminator "'" anywhere before EOF at -e line 1. Code:
$t1=time(); use ntheory; $p=86243; $bool=Math::Prime::Util::GMP::is_mersenne_prime($p); $dt=time()-$t1; print "exponent $p yields $bool in $dt seconds\n"; # $bool 0 composite, 1 prime Code:
time <cr.txt time <cr.txt perl pmp.pl time <cr.txt Interestingly, https://metacpan.org/pod/Math::Prime...mersenne_prime says it uses a list or table for various known Mersenne primes up to 37,156,667. The timings seem too long for that to be the case. |
|
|
|
|
|
|
#54 | |||
|
"Dana Jacobsen"
Feb 2011
Bangkok, TH
16148 Posts |
Quote:
As for timing, I don't do a lot with it on Windows. It looks like you have to do some work yourself, maybe with Time::HiRes. Quote:
Quote:
|
|||
|
|
|
|
|
#55 | |
|
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest
124528 Posts |
Quote:
In http://perldoc.perl.org/Time/HiRes.html They're not kidding when stating "Some calls simply aren't available, real or emulated, on every platform." Code:
use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep clock_gettime clock_getres clock_nanosleep clock stat lstat utime); Code:
Time::HiRes::ualarm(): unimplemented in this platform at hrt2.pl line 1. BEGIN failed--compilation aborted at hrt2.pl line 3 Code:
use Time::HiRes qw( usleep gettimeofday tv_interval stat lstat ); Last fiddled with by kriesel on 2018-08-09 at 02:39 |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Primality test based on factorization of n^2+n+1 | carpetpool | Miscellaneous Math | 5 | 2018-02-05 05:20 |
| Composites that pass Mathematica's pseudoprime test | grandpascorpion | Math | 15 | 2012-03-23 02:52 |
| Prime numbers Grid, to test an odd integer on 44 | Zarck | Math | 5 | 2012-03-06 14:43 |
| Faster Lucas-Lehmer test using integer arithmetic? | __HRB__ | Software | 188 | 2010-08-09 11:13 |
| please help me pass the test. | caliman | Hardware | 2 | 2007-11-08 06:12 |