mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2018-08-02, 19:49   #23
ktpn2011
 
Aug 2018
GEORGIA Republic

22×7 Posts
Default

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?
ktpn2011 is offline   Reply With Quote
Old 2018-08-02, 21:42   #24
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

124528 Posts
Default

Quote:
Originally Posted by ktpn2011 View Post
this is on CPU E8500, Win XP32.
I like code optimization in direct asm.
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.
kriesel is online now   Reply With Quote
Old 2018-08-02, 23:28   #25
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

203008 Posts
Default

Quote:
Originally Posted by ktpn2011 View Post

for now let me share idea of storing prime numbers.
before that, what methods (other then compression) are known?
is a bitsieve compression ?
science_man_88 is offline   Reply With Quote
Old 2018-08-03, 03:27   #26
ktpn2011
 
Aug 2018
GEORGIA Republic

22·7 Posts
Default

Quote:
Originally Posted by kriesel View Post
Implementing a slow algorithm..
I am about optimizing.. so than FFT or other can be optimized..

science_man_88 , as wrote, it is not about compression.
mostly for number 1byte.
ktpn2011 is offline   Reply With Quote
Old 2018-08-03, 05:42   #27
preda
 
preda's Avatar
 
"Mihai Preda"
Apr 2015

3·457 Posts
Default

Quote:
Originally Posted by ktpn2011 View Post
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?
This paper by Crandall & Fagin is a starting point, highly recommended:

https://www.ams.org/journals/mcom/19...-1185244-1.pdf
preda is offline   Reply With Quote
Old 2018-08-03, 13:11   #28
ktpn2011
 
Aug 2018
GEORGIA Republic

22·7 Posts
Default

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?
Attached Thumbnails
Click image for larger version

Name:	Clipboard06.png
Views:	125
Size:	11.3 KB
ID:	18872  

Last fiddled with by ktpn2011 on 2018-08-03 at 13:12
ktpn2011 is offline   Reply With Quote
Old 2018-08-03, 14:57   #29
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

597910 Posts
Default

Quote:
Originally Posted by ktpn2011 View Post
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?
I don't think you've given us enough information to work from. There are tons of ways of doing this, so probably the answer is yes, it's been done before, but I'm not at all sure what exactly you are doing.

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.
CRGreathouse is offline   Reply With Quote
Old 2018-08-03, 19:31   #30
ktpn2011
 
Aug 2018
GEORGIA Republic

22·7 Posts
Default

thanks, so that is differences.
ktpn2011 is offline   Reply With Quote
Old 2018-08-03, 21:51   #31
ewmayer
2ω=0
 
ewmayer's Avatar
 
Sep 2002
República de California

2D7E16 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
I don't think you've given us enough information to work from. There are tons of ways of doing this, so probably the answer is yes, it's been done before, but I'm not at all sure what exactly you are doing.

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.
I find a good balance between storage space and runtime is to store a precomputed table of base-2 Fermat pseudoprimes ('pseudo' here meaning false) not divisible by 3 or 5 up to one's desired bound, then combine a fast base-2 F-PRP test with a 30-based small-p sieve to generate candidates, each one passing those 2 filters gets compared to the next-expected false prime in the 2-PRP table:

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.
ewmayer is offline   Reply With Quote
Old 2018-08-04, 08:06   #32
ktpn2011
 
Aug 2018
GEORGIA Republic

22·7 Posts
Default

why call it storing method? rather, easy finding method.
ktpn2011 is offline   Reply With Quote
Old 2018-08-04, 10:17   #33
retina
Undefined
 
retina's Avatar
 
"The unspeakable one"
Jun 2006
My evil lair

24×389 Posts
Default

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?
retina is online now   Reply With Quote
Reply

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

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


Sun Aug 1 18:29:52 UTC 2021 up 9 days, 12:58, 0 users, load averages: 1.83, 2.31, 2.52

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.