mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2010-08-17, 00:41   #595
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
Do you know what "it" is?
To be honest, I have no idea.
3.14159 is offline   Reply With Quote
Old 2010-08-17, 00:44   #596
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Alright. To get back to the amateur siever. It's going to be a long and complicated script, and I'm afraid my current known commands aren't going to cut it.

Last fiddled with by 3.14159 on 2010-08-17 at 00:45
3.14159 is offline   Reply With Quote
Old 2010-08-17, 00:52   #597
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Alright. To get back to the amateur siever. It's going to be a long and complicated script, and I'm afraid my current known commands aren't going to cut it.
It should be about 6 lines long.

Maybe later we can work on it. Right now I'm doing other stuff, and I'm sure you're pretty well fried.
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 01:15   #598
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
It should be about 6 lines long.

Maybe later we can work on it. Right now I'm doing other stuff, and I'm sure you're pretty well fried.
Alright. Notify whenever ready.

Also: I unwittingly discovered this: 254164423 * 3700! + 1 is prime (11607 digits)

Last fiddled with by 3.14159 on 2010-08-17 at 01:43
3.14159 is offline   Reply With Quote
Old 2010-08-17, 01:35   #599
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

175B16 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Alright. Notify whenever ready.
SWEET, I finished the Gerbicz primorial function. Now if I can just get this sieve code to work, I'll be good to go... it's only 200 lines long, why does it cause me such trouble?

Radishes, radishes, radishes.

Last fiddled with by CRGreathouse on 2010-08-17 at 01:37
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 01:45   #600
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
SWEET, I finished the Gerbicz primorial function. Now if I can just get this sieve code to work, I'll be good to go... it's only 200 lines long, why does it cause me such trouble?
Ah, another day in the life of the average programmer..

An 11607-digit k * n! + 1 happens to be a personal record for primes of that type.

Last fiddled with by 3.14159 on 2010-08-17 at 01:51
3.14159 is offline   Reply With Quote
Old 2010-08-17, 02:40   #601
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

597910 Posts
Smile

OK, so funny story.

This project has two main parts: the sieve, which factors numbers into a specialized form, and the end function, which takes 256 bits of sieve data plus the number and determines what value it has (possibly stopping early if it can tell it won't be good enough). I had been over the end function pretty closely, checking it against 'known-good' code, so I was pretty sure the problem was with the sieve. I was having trouble figuring out just where... memory corruption? Bad interactions between the three types of primes it deals with? Etc.

So what was the problem? A tiny (~4 character) section of a line of code checking whether the value was a record or not.

So the first unoptimized version is now running. It's 20 times faster than the compiled script (to 1e8), which is slightly faster than the original script. Now I just need to clean up the code, remove all the testing apparatus, and start optimizing. As written, it will get faster and faster compared to the original code as it goes to higher ranges, but I think I can get another 20% improvement by removing multiples of small squares... it's not hard to prove that, beyond 49, all members of my sequence are squarefree.
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 03:08   #602
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

69016 Posts
Default

So, Charles: Is work on the sieve I want to construct beginning? I think I can do the forstep loops.

Last fiddled with by 3.14159 on 2010-08-17 at 03:08
3.14159 is offline   Reply With Quote
Old 2010-08-17, 03:46   #603
axn
 
axn's Avatar
 
Jun 2003

5,087 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
So, Charles: Is work on the sieve I want to construct beginning? I think I can do the forstep loops.
Do you know how to write pseudocode? Try writing the logic in a language-independent way. Best way to learn programming is by doing it.
axn is offline   Reply With Quote
Old 2010-08-17, 13:06   #604
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

69016 Posts
Default

Quote:
Originally Posted by axn
Do you know how to write pseudocode? Try writing the logic in a language-independent way. Best way to learn programming is by doing it.
Depends on language. I can definitely perform:
"print(x)"
3.14159 is offline   Reply With Quote
Old 2010-08-17, 15:14   #605
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

For the search for k * 4900! + 1; I set it to trial division only: I set it to between 4900 and 106. I'll only test the numbers that have no factors below 106.
(There are about 20k-30k candidates.)
I figured it would become too slow if I decided to do some deep TF. (I tested it at around the 50M range for the pmax.)

Quote:
Originally Posted by CRGreathouse
So what was the problem? A tiny (~4 character) section of a line of code checking whether the value was a record or not.
Need to proofread more often, there.

Last fiddled with by 3.14159 on 2010-08-17 at 15:22
3.14159 is offline   Reply With Quote
Reply



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

All times are UTC. The time now is 23:02.


Fri Aug 6 23:02:33 UTC 2021 up 14 days, 17:31, 1 user, load averages: 3.38, 3.93, 3.95

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.