Home Online Manual
Top
Back: number_pi
Forward: product
FastBack:
FastForward:
Up: general_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.2.3.13 primes

Procedure from library general.lib (see general_lib).

Usage:
primes(n,m); n,m integers

Return:
intvec, consisting of all primes p, prime(n)<=p<=m, in increasing order if n<=m, resp. prime(m)<=p<=n, in decreasing order if m<n.

Note:
prime(n); returns the biggest prime number <= min(n,32003) if n>=2, else 2

Example:
 
LIB "general.lib";
primes(50,100);"";
==> 47,53,59,61,67,71,73,79,83,89,97
==> 
intvec v = primes(37,1); v;
==> 37,31,29,23,19,17,13,11,7,5,3,2