The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



ListOfPrimes


Unit: SDL_math1
Class: None
Declaration: function ListOfPrimes (ix: integer): integer;

The function ListOfPrimes returns the first 4792 primes (from 2 to 46337). The parameter ix specifies the index into the list of primes, the valid range being from 1 to 4792. In the case of passing an invalid index, the function returns a zero value.

Hint: Please note that the highest prime - ListOfPrimes(4792) - is the highest prime whose square is just below 231. This will become important when checking whether a positive integer is prime.



Last Update: 2023-Feb-06