mersenneforum.org  

Go Back   mersenneforum.org > Prime Search Projects > Sierpinski/Riesel Base 5

Reply
 
Thread Tools
Old 2006-05-08, 10:46   #45
Greenbank
 
Greenbank's Avatar
 
Jul 2005

2×193 Posts
Default

Quote:
Originally Posted by Citrix
There is a way around it too. I leave it as a puzzle for you. (May be it will come to you, after the first drink)
Hint:-Think of the algorithm Silver....
SPH is used extensively within proth_sieve to reduce the search space however it won't solve this problem.

1) SPH is only calculated on a few low factors of p-1. Calculating ALL factors of every p-1 would take more time and, in my experience anyway, is slower than computing a few.

2) SPH doesn't guarantee that the search space is radically cut down. Many primes are of the form: (2*p)+1 where p is prime itself.

i.e. 115325353710899 is prime and 115325353710898 is 2 * 57662676855449.

SPH is not useful here and is less efficient that normal BSGS and so we are back to the same problem. We have to solve the DL by checking every exponent up to (p-1)/2.

Quote:
Originally Posted by axn1
I don't know too much about the mathematics here. But sounds to me like there is not algorithmic improvement here. All you are doing here is solving the Discrete Logarithm problem -- twice. Does it matter whether you solve it in the "native base" directly or solve it for base 2 first and then convert that to the "native base"?!

Maybe I'm just way off base here
The questions raised in this discussion are useful, especially as other people can read them and add their input.

The main point is that proth_sieve is highly optimised for sieving base=2 Proth/Riesel numbers. To change it to use base 5 would take some work. If this trick was to work every time then it would be possible to, with much less work that overhauling proth_sieve completely, to add arbitrary base support.

The problem is that although it works in theory it is not possible to use this 'trick' to provide arbitrary base support to proth_sieve. The 'trick' can not be efficiently implemented as it breaks some of the assumptions that were made about the required exponents.

As for solving the DL twice, the current sievers do more than this. Consider sieving for 83 different k-values (as Riesel sieve has in the past, a few may have been removed recently).

With a bit of precomputation, on average, half of these k values will be removed by checking quadratic reciprocity. So we are left with about 40 different k-values to check.

The sievers essentially solve all 42 different DLs that are left, but they share a large amount of work (the giant-steps or baby-steps hash table generation depending on how BSGS has been implemented).

Adding one final DL to solve to allow a solution for non-base 2 DLs isn't that much work when you are already doing 40.
Greenbank is offline   Reply With Quote
Old 2006-05-08, 14:28   #46
Joe O
 
Joe O's Avatar
 
Aug 2002

3×52×7 Posts
Default

Since you've renamed functions, this is difficult to write.
The original ht = mul_mod_p_b( ht, gstep ); was faster than ht = mul_mod_p( ht, gstep ); even if you included the calculation of gstep/p; So I'm suprised that you are using ht = mul_mod_p( ht, gstep ); unless that is a rename too.
Joe O is offline   Reply With Quote
Old 2006-05-08, 18:48   #47
axn
 
axn's Avatar
 
Jun 2003

31·163 Posts
Default

Quote:
Originally Posted by Greenbank
Adding one final DL to solve to allow a solution for non-base 2 DLs isn't that much work when you are already doing 40.
Much thanks! That clears it up!
axn is online now   Reply With Quote
Old 2006-05-09, 01:53   #48
geoff
 
geoff's Avatar
 
Mar 2003
New Zealand

13×89 Posts
Default version 0.0.9

The last bug fix didn't work (and made things worse) when starting a new sieve. As before, --check would have caught any problem. This version fixes it.
geoff is offline   Reply With Quote
Old 2006-05-09, 09:39   #49
Greenbank
 
Greenbank's Avatar
 
Jul 2005

2·193 Posts
Default

Quote:
Originally Posted by Joe O
Since you've renamed functions, this is difficult to write.
The original ht = mul_mod_p_b( ht, gstep ); was faster than ht = mul_mod_p( ht, gstep ); even if you included the calculation of gstep/p; So I'm suprised that you are using ht = mul_mod_p( ht, gstep ); unless that is a rename too.
OK, I see why we are all getting confused. We've changed more of the code that I had remembered.

The mulmod and powmod code have both been changed to use magic number multiplication. Mark implemented this and it came from _Hackers_Delight_ by Herny S. Warren (ISBN 0201914654).

In essence it's similar to montgomery or barrett multiplication methods.

For each new p value, two new values are calculated: pMagic and pShift. These are used by the mulmod, powmod and pow2mod functions and are safe to use up to values of 2^63.

mul_mod_p() in our proth_sieve is much faster using this method than the FPU multiplication method used in the x86 proth_sieve.

mul_mod_p_b() is an implementation of montgomery multiplication. It it is just 4 multiplies, two additions and a conditional subtract. All of these operations are 64-bit.

So mul_mod_p() is used but only when the number of iterations is less than 5, but out mul_mod_p() is about twice the speed of the standard FPU version.
Greenbank is offline   Reply With Quote
Old 2006-05-09, 20:23   #50
jasong
 
jasong's Avatar
 
"Jason Goatcher"
Mar 2005

3×7×167 Posts
Default

I have no idea how to compile the program, so I'm not sure what to do.

I only have a Sempron, so if my only choice is LLR, I'm moving on to something else.

Advice, please.
jasong is offline   Reply With Quote
Old 2006-05-09, 21:02   #51
axn
 
axn's Avatar
 
Jun 2003

10011101111012 Posts
Default

Quote:
Originally Posted by geoff
The last bug fix didn't work (and made things worse) when starting a new sieve. As before, --check would have caught any problem. This version fixes it.
7-zip is having a tough time opening the tar file
axn is online now   Reply With Quote
Old 2006-05-10, 04:37   #52
geoff
 
geoff's Avatar
 
Mar 2003
New Zealand

48516 Posts
Default

Quote:
Originally Posted by jasong
I have no idea how to compile the program, so I'm not sure what to do.
For x86 Linux just type `make'. For x86 Windows you will need to install whatever is usually needed to compile programs such as gmp-ecm, ggnfs, etc., probably the cygwin libraries. For non-x86 systems I just don't know. If anyone has successfully compiled it, please let me know what if anything you needed to change.

Quote:
Originally Posted by axn1
7-zip is having a tough time opening the tar file
I will post a .zip file as well next time, or is it a file corruption problem?
geoff is offline   Reply With Quote
Old 2006-05-10, 10:53   #53
Greenbank
 
Greenbank's Avatar
 
Jul 2005

18216 Posts
Default

I just compiled it under Cygwin but it took a bit of hacking to get it to work.

Seems that the gcc I have (3.4.4) really didn't like the '_mulmod62' and '_one_over_p' references. I had to remove the leading underscore before they would compile properly.

The 'fixed' source can be found at: http://www.greenbank.org/misc/cygwin...-0.0.10.tar.gz

You can diff it against the original 0.0.10 source to check that I haven't added anything silly.
Greenbank is offline   Reply With Quote
Old 2006-05-10, 11:44   #54
axn
 
axn's Avatar
 
Jun 2003

10011101111012 Posts
Default

Quote:
Originally Posted by geoff
I will post a .zip file as well next time, or is it a file corruption problem?
D'oh! Should be more specific, shouldn't I? The tar is corrupted. I was able to open the previous versions without any problem.
axn is online now   Reply With Quote
Old 2006-05-10, 18:52   #55
axn
 
axn's Avatar
 
Jun 2003

13BD16 Posts
Default

Quote:
Originally Posted by Greenbank
I just compiled it under Cygwin but it took a bit of hacking to get it to work.

Seems that the gcc I have (3.4.4) really didn't like the '_mulmod62' and '_one_over_p' references. I had to remove the leading underscore before they would compile properly.

The 'fixed' source can be found at: http://www.greenbank.org/misc/cygwin...-0.0.10.tar.gz

You can diff it against the original 0.0.10 source to check that I haven't added anything silly.
Once mulmod62 is also inlined, this problem should go away.
axn is online now   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Very Prime Riesel and Sierpinski k robert44444uk Open Projects 587 2016-11-13 15:26
Sierpinski/ Riesel bases 6 to 18 robert44444uk Conjectures 'R Us 139 2007-12-17 05:17
Sierpinski/Riesel Base 10 rogue Conjectures 'R Us 11 2007-12-17 05:08
Sierpinski / Riesel - Base 23 michaf Conjectures 'R Us 2 2007-12-17 05:04
Sierpinski / Riesel - Base 22 michaf Conjectures 'R Us 49 2007-12-17 05:03

All times are UTC. The time now is 09:18.


Sat Jul 17 09:18:51 UTC 2021 up 50 days, 7:06, 1 user, load averages: 2.57, 1.95, 1.73

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.