![]() |
|
|
#23 |
|
Aug 2018
GEORGIA Republic
22×7 Posts |
this is on CPU E8500, Win XP32.
I like code optimization in direct asm. So now I like to see other code speeds compared to others coding & publish my codes. I am ready to start optimize other interesting codes.. for now let me share idea of storing prime numbers. before that, what methods (other then compression) are known? |
|
|
|
|
|
#24 |
|
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest
124528 Posts |
Implementing a slow algorithm, even well, with assembler is not an optimization, compared to an efficient algorithm. At exponents of current interest, anything less than an fft method of squaring is a slow algorithm.
|
|
|
|
|
|
#25 |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
|
|
|
|
|
|
#26 |
|
Aug 2018
GEORGIA Republic
22·7 Posts |
|
|
|
|
|
|
#27 | |
|
"Mihai Preda"
Apr 2015
3·457 Posts |
Quote:
https://www.ams.org/journals/mcom/19...-1185244-1.pdf |
|
|
|
|
|
|
#28 |
|
Aug 2018
GEORGIA Republic
22·7 Posts |
thank for link, but maybe you did not understood my question about storing method for prime numbers.
here is attachment. I collect & store prime numbers using mostly 1 byte for each. Is something like this implemented? Last fiddled with by ktpn2011 on 2018-08-03 at 13:12 |
|
|
|
|
|
#29 | |
|
Aug 2006
597910 Posts |
Quote:
One method is to store differences (or half-differences, or the like) between primes. Another method is to store bitmaps of primes; a popular technique is to have a byte represent a block of 30 numbers, each one representing the primality of 30n + 1, 30n + 7, ..., 30n + 29. |
|
|
|
|
|
|
#30 |
|
Aug 2018
GEORGIA Republic
22·7 Posts |
thanks, so that is differences.
|
|
|
|
|
|
#31 | |
|
∂2ω=0
Sep 2002
República de California
2D7E16 Posts |
Quote:
1. If (current candidate != next-false-prime), it's prime; 2. If (current candidate == next-false-prime), it's not prime, and we reset next-false-prime to the next entry in the precomputed table. A table of the above form to cover all primes < 2^32 has fewer than 10000 entries. |
|
|
|
|
|
|
#32 |
|
Aug 2018
GEORGIA Republic
22·7 Posts |
why call it storing method? rather, easy finding method.
|
|
|
|
|
|
#33 |
|
Undefined
"The unspeakable one"
Jun 2006
My evil lair
24×389 Posts |
You are storing them, great. But then what? What are your retrieval requirements? Do prioritise fast retrieval over storage space, or the opposite, or some balance? What are your precise criteria?
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Primality test based on factorization of n^2+n+1 | carpetpool | Miscellaneous Math | 5 | 2018-02-05 05:20 |
| Composites that pass Mathematica's pseudoprime test | grandpascorpion | Math | 15 | 2012-03-23 02:52 |
| Prime numbers Grid, to test an odd integer on 44 | Zarck | Math | 5 | 2012-03-06 14:43 |
| Faster Lucas-Lehmer test using integer arithmetic? | __HRB__ | Software | 188 | 2010-08-09 11:13 |
| please help me pass the test. | caliman | Hardware | 2 | 2007-11-08 06:12 |