But wouldn't it also take a lot of memory to store a hard coded array of prime numbers? Or if it was a file you would have to read the entire file each time, not to mention the size of the file....
Type: Posts; User: bgroenks96
But wouldn't it also take a lot of memory to store a hard coded array of prime numbers? Or if it was a file you would have to read the entire file each time, not to mention the size of the file....
But.... that's tedious. And we're talking every prime number up to Integer.MAX_VALUE. Not just from 2-100.
Oh and I just wanted to add I'm also self-taught with a year now of experience. Last...
No this isn't homework. Programming is a hobby/planned career of mine and I love doing it.
What I'm looking for is just randomly generating a prime number, and I would prefer not to fall back on...
It appears to me that the Sieve of Eratosthenes, while easy to implement, is not at all scalable.
If you have to create a boolean array to store all of those values in up to the limit, that begins...