mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

3.14159 2010-08-17 00:41

[QUOTE=CRGreathouse]Do you know what "it" is?
[/QUOTE]

To be honest, I have no idea.

3.14159 2010-08-17 00:44

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.

CRGreathouse 2010-08-17 00:52

[QUOTE=3.14159;225785]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.[/QUOTE]

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.

3.14159 2010-08-17 01:15

[QUOTE=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.[/QUOTE]

Alright. Notify whenever ready.

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

CRGreathouse 2010-08-17 01:35

[QUOTE=3.14159;225792]Alright. Notify whenever ready.[/QUOTE]

SWEET, I finished the Gerbicz primorial function. Now if I can just get this :censored: 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.

3.14159 2010-08-17 01:45

[QUOTE=CRGreathouse]SWEET, I finished the Gerbicz primorial function. Now if I can just get this :censored: sieve code to work, I'll be good to go... it's only 200 lines long, why does it cause me such trouble?
[/QUOTE]

Ah, another day in the life of the average programmer.. :missingteeth:

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

CRGreathouse 2010-08-17 02:40

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.

3.14159 2010-08-17 03:08

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

axn 2010-08-17 03:46

[QUOTE=3.14159;225805]So, Charles: Is work on the sieve I want to construct beginning? I think I can do the forstep loops.[/QUOTE]

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.

3.14159 2010-08-17 13:06

[QUOTE=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.
[/QUOTE]

Depends on language. I can definitely perform:
"print(x)"

3.14159 2010-08-17 15:14

For the search for k * 4900! + 1; I set it to trial division only: I set it to between 4900 and 10[sup]6[/sup]. I'll only test the numbers that have no factors below 10[sup]6[/sup].
(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=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.
[/QUOTE]

:missingteeth: Need to proofread more often, there.


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

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