An iteration produces all the prime numbers
|
02-14-2021, 03:05 PM
Post: #5
|
|||
|
|||
RE: An iteration produces all the prime numbers
For fairly simple methods of quickly producing primes (faster than the sieve of Eratosthenes), check out "wheels." The idea is to start with 2 (or seed with 2,3,5,7...) and as one goes, one dynamically changes the sieving process to pickup more primes. First one gets 6*K+(1,5) then 30*K+(1,7,11,13,17,19,23,29) and so forth. I like the 30*k method as I can store 30 blocks of 30 numbers in a single byte. Later, one needs fancier methods. It becomes more efficient to store the distances between primes. Then even store that distance using a Universal Code.
https://en.wikipedia.org/wiki/Wheel_factorization https://en.wikipedia.org/wiki/Universal_...mpression) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)