-
program problem
I made that prime number thing that I posted about a couple days ago. If you hadn't read that post, I found the first million prime numbers with it. This took about 5-6 hours on my 933mhz computer, but I had a problem that I couldn't minimize the program. I haven't had too much experience with things like that, and it is probalby a dumb question, but how can I make it possible to minimize a win32 console app when it is doing calculations like that?
-
Hi,
As you can probably guess, your program will be using a lot of resources when performing these caculations. When working in a console enviorment you are fairly restricted to fixing this. And i am not to sure of a method that you could apply to it. But i can advise you to learn the win 32 api, then you can use threads to fix this problem, doing this will allow all your programs calcualtions to be performed in a seperate block of code away from you main program, making it minimizable.
Hope thats some help,
Cheers
TNT
-
I'd change your algorithm, the link I posted in your last thread led to some code that will find the first 910077 prime numbers in around 2 seconds.
-
I did see your code, but I don't understand how that could actually work correctly and with all prime numbers.
-
It wasn't my code (mine only got the prime numbers up to 1000000), but was based on the same principle, only more complex. What prime numbers wouldn't it get?
-
I just didn't understand how it could work and be faster
-
It didn't have to re-calculate each prime number individually, but built a table of prime numbers. It's not something I came up that day, it's been widely recognised as being one of the most efficient methods of establishing prime numbers(unless you want very large amounts) for a couple of thousand years.