43

Made a program to list primes until stopped. I got to about 2 billion when it took 8 GB of RAM and I more or less had to stopped it.

Only took 10% of CPU though.

Comments
  • 3
    What algorithm did you use?
  • 0
    Dot for notifs
  • 3
    @sljux I really mean "I copied from Haskell wiki," but i think it was Eratosthenes sieve.
  • 2
    @Supernerd yeah, makes sense to eat up the RAM
  • 0
    @sljux Rewrote it in rust, but still took 8 GB RAM at 2 billion something.
  • 5
    Rewrite using disk space instead of ram and see how it goes!
  • 1
    I got to 10 billion after about 4h. Next task is to write to disk.
  • 0
    What's the digit count in the biggest prime you have?
  • 1
    @mt3o 10 digits
  • 1
    @SHA-16384 aren't they like, infinite?
  • 1
    @Supernerd wow that's. Large.
  • 2
    Why let numbers loaded in memory, why not just store them in a file when they're prime, and unload the others ?
    The program should be slower but you can run it really longer and calculate more prime numbers
  • 1
    I don't think using only 10% of CPU is a good thing. It just means it could have run 10 times faster.
  • 0
    @devios1 not necessarily. If it's using only 1 core, this might happen. Besides, there might be a bottle neck somewhere.
    Even though, the sieve is not so good algorithm for multithreading.
Add Comment