![]() |
|
|
#34 | |
|
"Richard B. Woods"
Aug 2002
Wisconsin USA
769210 Posts |
Quote:
|
|
|
|
|
|
|
#35 |
|
Romulan Interpreter
Jun 2011
Thailand
258A16 Posts |
Of course. I was talking only about storage. About the necessary time, well, it may be even more costly that you said, or it may be not. Because you need anyhow FFT for squaring and you will need a lot of squares at the end, for each bit in that large product. In the way as we are currently doing, primes can be paired to optimize the exponentiation, and taking the modulus each step reduces the number of squares too. If you compute and store the product before, there is no pairing and no optimization possible, but you only need to do exponentiation for each exponent p (no overload), so you may get away cheaper for a large set of p's. What do I mean, if you raise b at the power of 101 (7 bits number) mod 20 bits number, you do 6 squarings of 20 bits numbers. Then you raise the result at 103, another 6 squarings. If you multiply x=101*103=10403 and raise b^x, then this is 13 bits number, you still do 12 squares of a 20 bit number, can't get cheaper. Of course, you did an additional short multiplication for x, but if you have to test 100 p's, then you only did the overload once (like the trouble of finding that 103 is the interesting one after 101, for example, is part of the overload, and in the first case you have to do it 100 times).
Since I try to implement some p-1 algorithm I cooked this donut on all sides, and honestly I don't know which solution is the best. Last fiddled with by LaurV on 2012-08-29 at 16:59 |
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Best Work for Finding Primes | Unregistered | Information & Answers | 9 | 2012-06-24 13:50 |
| New method of finding large prime numbers | georgelouis@mac | Math | 41 | 2011-01-25 21:06 |
| Finding the square root of a large mersenne number | Fusion_power | Math | 29 | 2010-10-14 17:05 |
| newbie question - finding small factors of very large numbers | NeoGen | Math | 7 | 2007-03-13 00:04 |
| Finding primes with a PowerPC | rogue | Lounge | 4 | 2005-07-12 12:31 |