PRIMES

The PRIMES function computes the first K prime numbers. The result is a K -element long integer vector.

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.

Calling Sequence

Result = PRIMES( K )

Arguments

K

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

Example

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