Generating prime numbers

Sometimes applications require prime numbers--positive integers with no divisors but one and themselves. For example, hash tables are optimally of prime size. This statement computes the next prime larger than a given value:

    unsigned long tableSize = NextPrimeAfter(EstimateTableSize());

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker