How to make code run differently depending on the platform it is running on?
xarzu - Apr 05 2019 09:17 AM
How do I set a breakpoint in an attached process in visual studio
xarzu - Apr 04 2019 11:47 AM
Recent Blog Entries
Recent Status Updates
- Managed C++
- Visual Basic 4 / 5 / 6
- linked list
- hello world
Prime number formula
Posted 11 August 2012 - 01:40 AM
My task is for 2 given numbers, to write all prime numbers between them.
Posted 11 August 2012 - 02:34 AM
Microsoft Student Partner, Microsoft Certified Professional
Posted 11 August 2012 - 05:37 AM
Posted 11 August 2012 - 06:13 AM
If you want to simplify the algorithm, check only odd numbers as an even number (besides 2) can not be a prime number.
I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.
Posted 11 August 2012 - 06:33 AM
And there are still other algorithms available for testing. See them here. But many agree that the fastest algorithm is the Sieve of Atkin. However for small range I don't think it will give significant increase of speed.
Posted 11 August 2012 - 05:51 PM
My MineCraft server site: http://banishedwings.enjin.com/
Posted 11 August 2012 - 06:09 PM
Look at the recurrence relation. The article claims that the sequence contains only primes and 1s. It linked to a proof which I haven't looked at but assuming this is true then you can use the reccurence to generate so many numbers and put them into a set. Put the numbers into a set and remove 1 from that set to get a set of primes.
This is neat - though it doesn't appear useful if you want all prime numbers up to some number n.