View Full Version : Urgent: Prime Number Algorithm [C++/pseudocode]
February 14th, 2002, 17:43
Anyone know how to generate all the primes less than n in a relatively quick fashion? If I were to use nested loops, I'll get points taken off for efficiency...I'm looking for a linear algorithm.
C++ code is welcomed, but pseudocode explanations are as well.
February 14th, 2002, 18:24
I do have an algorithm, but take a look at these results:
Enter the limit for which odd psuedo and regular prime numbers
less than this number will be found: 30
Total comparisons: 1.26645e+07
Total resizes: 8
February 15th, 2002, 01:23
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.