![]() |
|
|
#2454 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
one thing I realized was that x=vecsort(x,,8) eliminated more than #x=#vecsort(x), because it also asked setisset(x) effectively which allows use to only use ones that are in order already.
|
|
|
|
|
|
#2455 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
Quote:
edit: doh, what am I thinking I just realized something before I posted and forgot it already. [2,n-3] will catch all for primes above it as wells so unless I go down through the primes both the parforprime and others save none. edit2: nevermind I realized that I'm not looking up to n-1 again. Last fiddled with by science_man_88 on 2014-05-07 at 18:30 |
|
|
|
|
|
|
#2456 | |
|
Aug 2006
3·1,993 Posts |
Quote:
Set(x) is basically a better version of vecsort(x,,8) if your version is new enough that Set([1])==[1] . |
|
|
|
|
|
|
#2457 | |
|
Aug 2006
3×1,993 Posts |
Quote:
You should test this before using to make sure your version can actually make reasonable use of it. Try something like parforprime(p=2,7, runs_for_10_seconds()) to see if it runs in ~10 seconds or ~40 seconds (assuming 4 cores, adjust to suit otherwise). |
|
|
|
|
|
|
#2458 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
parforprime still didn't make sense and seems to be slower for simple things. on another note:
Code:
p=11;a=binary(2^((p-1)/2-1)-1);s=14;for(x=1,#a,s=(Mod(s,(2^p-1))^2-2)^2-2);s http://www.mersenne.org/various/math...rial_factoring , anyways off to make my other code better I guess. |
|
|
|
|
|
#2459 |
|
Aug 2006
10111010110112 Posts |
|
|
|
|
|
|
#2460 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
well there's that, but also once p=2 is done it covers everything else because every value in the limits [amin,amax] will fall between 2,n-3 the only thing this misses is when n-1 is prime. So doing it first doesn't make sense but even doing it in reverse order doesn't either without a check on if it's already in c because as p decreases the range [p,n-(p+1)] is larger than [nextprime(p),n-(nextprime(p)+1)], for some reason I'm getting your code to be slower than mine overall.
|
|
|
|
|
|
#2461 |
|
Aug 2006
175B16 Posts |
Which codes are you comparing? I think we've both posted several.
|
|
|
|
|
|
#2462 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
Quote:
http://mersenneforum.org/showpost.ph...postcount=2453 if I take out the solve part you have that my original didn't yours takes 378 ms if I add your solve in my code takes 129 ms so it's really only the solve I can find as faster. if I add in the ( I typed it wrong before) improvement of using the check x==vecsort(x,,8) I get it down to ~111 ms for mine. and even with your solve back into it plus an equivalent to my check by using Vec(x)==Set(x) yours doesn't go below 200 ms. Last fiddled with by science_man_88 on 2014-05-09 at 14:41 |
|
|
|
|
|
|
#2463 |
|
Aug 2006
3·1,993 Posts |
Since you didn't answer my question I won't bother doing my own analysis.
|
|
|
|
|
|
#2464 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why do I sometimes see all the <> formatting commands when I quote or edit? | cheesehead | Forum Feedback | 3 | 2013-05-25 12:56 |
| Passing commands to PARI on Windows | James Heinrich | Software | 2 | 2012-05-13 19:19 |
| Ubiquity commands | Mini-Geek | Aliquot Sequences | 1 | 2009-09-22 19:33 |
| 64-bit Pari? | CRGreathouse | Software | 2 | 2009-03-13 04:22 |
| Are these commands correct? | jasong | Linux | 2 | 2007-10-18 23:40 |