Loading ...
Sorry, an error occurred while loading the content.

Re: [PrimeNumbers] Question.

Expand Messages
  • Jud McCranie
    ... It should take very little time to generate the first 100,000 primes with a sieve of Erathostenes. Are you doing it a harder way? ... I don t know what
    Message 1 of 23 , Dec 30, 2002
    • 0 Attachment
      At 01:47 AM 12/30/2002 -0800, Peter Boos wrote:
      >yep, right !
      >
      >my hardware isn't that great it's a pentium 70.
      >So when I want to do something with a lot of numbers
      >this cost me lot's of time, for example checking the
      >first 100.000 primes takes quite a while.

      It should take very little time to generate the first 100,000 primes with a
      sieve of Erathostenes. Are you doing it a harder way?


      >Now since i deal with this prime number file I just
      >wonder how to store them with the least amount of disk
      >space.

      I don't know what the absolute minimum space to store a list of primes is,
      but there will be a trade-off - the more compact the file, probably the
      more processing it is going to take to get the numbers out.

      If I'm going over 2^32 I generate them with a sieve. Less than 2^32 I
      usually read them from a file. I have three types of file: the primes as
      32-bit unsigned integers (the largest but easiest to deal with), the gaps
      between successive primes, and a bit-vector. The last two take less space
      and are good for various things, depending on what you need.




      +---------------------------------------------------------+
      | Jud McCranie |
      | |
      | Programming Achieved with Structure, Clarity, And Logic |
      +---------------------------------------------------------+



      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.