Mercurial > hg > octave-nkf
comparison scripts/specfun/primes.m @ 9141:c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Split section into "Exponents and Logarithms" and "Utility Functions"
Use Tex in many more of the doc strings for pretty printing in pdf format.
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Mon, 20 Apr 2009 17:16:09 -0700 |
parents | eb63fbe60fab |
children | 8c71a86c4bf4 |
comparison
equal
deleted
inserted
replaced
9140:c309e028185e | 9141:c1fff751b5a8 |
---|---|
19 ## -*- texinfo -*- | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function File} {} primes (@var{n}) | 20 ## @deftypefn {Function File} {} primes (@var{n}) |
21 ## | 21 ## |
22 ## Return all primes up to @var{n}. | 22 ## Return all primes up to @var{n}. |
23 ## | 23 ## |
24 ## The algorithm used is the Sieve of Erastothenes. | |
25 ## | |
24 ## Note that if you need a specific number of primes, you can use the | 26 ## Note that if you need a specific number of primes, you can use the |
25 ## fact the distance from one prime to the next is on average | 27 ## fact the distance from one prime to the next is on average |
26 ## proportional to the logarithm of the prime. Integrating, you find | 28 ## proportional to the logarithm of the prime. Integrating, you find |
27 ## that there are about @math{k} primes less than @math{k \log (5 k)}. | 29 ## that there are about @math{k} primes less than @math{k \log (5 k)}. |
28 ## | |
29 ## The algorithm used is called the Sieve of Erastothenes. | |
30 ## @end deftypefn | 30 ## @end deftypefn |
31 | 31 |
32 ## Author: Paul Kienzle | 32 ## Author: Paul Kienzle |
33 ## Author: Francesco Potort́ | 33 ## Author: Francesco Potort́ |
34 ## Author: Dirk Laurie | 34 ## Author: Dirk Laurie |