PRIMES

The PRIMES function computes the first K prime numbers.

This routine is written in the IDL language. Its source code can be found in the file primes.pro in the lib subdirectory of the IDL distribution.

Examples

To compute the first 25 prime numbers:

PRINT, PRIMES(25)

IDL prints:

 2     3     5     7    11    13

17    19    23    29    31    37

41    43    47    53    59    61

67    71    73    79    83    89

97

Syntax

Result = PRIMES(K)

Return Value

The result is a K-element long integer vector.

Arguments

K

An integer or long integer scalar that specifies the number of primes to be computed.

Version History

4.0

Introduced