Home > freetb4matlab > specfun > primes.m

primes

PURPOSE ^

%

SYNOPSIS ^

function x = primes (p)

DESCRIPTION ^

% -*- texinfo -*-
% @deftypefn {Function File} {} primes (@var{n})
%
% Return all primes up to @var{n}.  
%
% The algorithm used is the Sieve of Erastothenes.
%
% Note that if you need a specific number of primes you can use the
% fact the distance from one prime to the next is, on average,
% proportional to the logarithm of the prime.  Integrating, one finds
% that there are about @math{k} primes less than
% @tex
% $k \log (5 k)$.
% @end tex
% @ifnottex
% k*log(5*k).
% @end ifnottex
% @seealso{list_primes, isprime}
% @end deftypefn

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 22-May-2009 15:13:00 by m2html © 2003