Skip to content
Permalink
Browse files

Add new AsciiDoc man page

  • Loading branch information...
kimwalisch committed Nov 4, 2019
1 parent acac95a commit 5ffbef1f79fee338c648dd5a0f4d333a2402b11a
Showing with 246 additions and 66 deletions.
  1. +1 −0 .gitignore
  2. +131 −66 doc/primesieve.1
  3. +114 −0 doc/primesieve.txt
@@ -19,6 +19,7 @@ install_manifest.txt
CTestTestfile.cmake
/primesieve*
/libprimesieve*
doc/primesieve.xml
doc/Doxyfile
doc/html
doc/latex
@@ -1,70 +1,135 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH PRIMESIEVE "1" "October 2019" ""primesieve 7.5"" ""primesieve""
.SH NAME
primesieve \- efficient prime number generator
.SH SYNOPSIS
.B primesieve
[\fI\,START\/\fR] \fI\,STOP \/\fR[\fI\,OPTION\/\fR]...
.SH DESCRIPTION
Generate the primes and/or prime k\-tuplets inside [START, STOP]
(< 2^64) using the segmented sieve of Eratosthenes.
.SH OPTIONS
.TP
\fB\-c[N\fR+], \fB\-\-count[\fR=\fI\,N\/\fR+]
Count primes and prime k\-tuplets, N <= 6,
e.g. \fB\-c1\fR primes, \fB\-c2\fR twins, \fB\-c3\fR triplets, ...
.TP
'\" t
.\" Title: primesieve
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 11/04/2019
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "PRIMESIEVE" "1" "11/04/2019" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
primesieve \- generate prime numbers
.SH "SYNOPSIS"
.sp
\fBprimesieve\fR [\fISTART\fR] \fISTOP\fR [\fIOPTION\fR]\&...
.SH "DESCRIPTION"
.sp
Generate the prime numbers and/or prime k\-tuplets inside [START, STOP] (< 2^64) using the segmented sieve of Eratosthenes\&. primesieve includes a number of extensions to the sieve of Eratosthenes which further improve performance: multiples of small primes are pre\-sieved, it uses wheel factorization to skip multiples with small prime factors and it uses the bucket sieve algorithm which improves cache efficiency when sieving > 2^32\&. primesieve is also multi\-threaded, it uses all available CPU cores by default for counting primes and for finding the nth prime\&.
.sp
The runtime complexity of the segmented sieve of Eratosthenes is O(n log log n) operations and it uses O(n^(1/2)) memory\&. More specifically primesieve uses 8 bytes per sieving prime, hence its memory usage can be approximated by PrimePi(n^(1/2)) * 8 bytes (per thread)\&.
.SH "OPTIONS"
.PP
\fB\-c\fR[\fINUM+\fR], \fB\-\-count\fR[=\fINUM+\fR]
.RS 4
Count primes and/or prime k\-tuplets, 1 <= NUM <= 6\&. Count primes: \-c or \-\-count, count twin primes: \-c2 or \-\-count=2, count prime triplets: \-c3 or \-\-count=3, \&... You can also count primes and prime k\-tuplets at the same time, e\&.g\&. \-c123 counts primes, twin primes and prime triplets\&.
.RE
.PP
\fB\-\-cpu\-info\fR
Print CPU information
.TP
\fB\-d\fR<N>, \fB\-\-dist=\fR<N>
Sieve the interval [START, START + N]
.TP
\fB\-h\fR, \fB\-\-help\fR
Print this help menu
.TP
\fB\-n\fR, \fB\-\-nth\-prime\fR
Calculate the nth prime,
e.g. 1 100 \fB\-n\fR finds the 1st prime > 100
.TP
.RS 4
Print CPU information: CPU name, frequency, number of cores, cache sizes, \&...
.RE
.PP
\fB\-d\fR, \fB\-\-dist\fR=\fIDIST\fR
.RS 4
Sieve the interval [START, START + DIST]\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Print this help menu\&.
.RE
.PP
\fB\-n\fR, \fB\-\-nth\-prime\fR
.RS 4
Find the nth prime, e\&.g\&. 100 \-n finds the 100th prime\&. If 2 numbers
\fIN\fR
\fISTART\fR
are provided finds the nth prime > START, e\&.g\&. 2 100 \-n finds the 2nd prime > 100\&.
.RE
.PP
\fB\-\-no\-status\fR
Turn off the progressing status
.TP
\fB\-p[N]\fR, \fB\-\-print\fR[=\fI\,N\/\fR]
Print primes or prime k\-tuplets, N <= 6,
e.g. \fB\-p1\fR primes, \fB\-p2\fR twins, \fB\-p3\fR triplets, ...
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Quiet mode, prints less output
.TP
\fB\-s\fR<N>, \fB\-\-size=\fR<N>
Set the sieve size in KiB, N <= 4096
.TP
.RS 4
Turn off the progressing status\&.
.RE
.PP
\fB\-p\fR[\fINUM\fR], \fB\-\-print\fR[=\fINUM\fR]
.RS 4
Print primes or prime k\-tuplets, 1 <= NUM <= 6\&. Print primes: \-p, print twin primes: \-p2, print prime triplets: \-p3, \&...
.RE
.PP
\fB\-q\fR, \fB\-\-quiet\fR
.RS 4
Quiet mode, prints less output\&.
.RE
.PP
\fB\-s\fR, \fB\-\-size\fR=\fISIZE\fR
.RS 4
Set the size of the sieve array in KiB, 8 <= SIZE <= 4096\&. By default primesieve uses a sieve size that matches your CPU\(cqs L1 cache size or half of your CPU\(cqs L2 cache size (per core)\&. This setting is crucial for performance, on exotic CPUs primesieve sometimes fails to determine the CPU\(cqs cache sizes which usually causes a big slowdown\&. In this case you can get a significant speedup by manually setting the sieve size to the CPU\(cqs L1 or L2 cache size (per core)\&.
.RE
.PP
\fB\-\-test\fR
Run various sieving tests
.TP
\fB\-t\fR<N>, \fB\-\-threads=\fR<N>
Set the number of threads, N <= CPU cores
.TP
.RS 4
Run various sieving tests\&.
.RE
.PP
\fB\-t\fR, \fB\-\-threads\fR=\fINUM\fR
.RS 4
Set the number of threads, 1 <= NUM <= CPU cores\&. By default primesieve uses all available CPU cores for counting primes and for finding the nth prime\&.
.RE
.PP
\fB\-\-time\fR
Print the time elapsed in seconds
.TP
\fB\-v\fR, \fB\-\-version\fR
Print version and license information
.SH EXAMPLES
.TP
primesieve 1000
Count the primes below 1000
.TP
primesieve 1000 \-c2
Count the twin primes below 1000
.TP
primesieve 1e6 \-p
Print the primes below 10^6
.TP
primesieve 100 200 \-p
Print the primes inside [100, 200]
.SH COPYRIGHT
Copyright \(co 2010 \- 2019 Kim Walisch
.PP
BSD 2\-Clause License <https://opensource.org/licenses/BSD\-2\-Clause>
.RS 4
Print the time elapsed in seconds\&.
.RE
.PP
\fB\-v\fR, \fB\-\-version\fR
.RS 4
Print version and license information\&.
.RE
.SH "EXAMPLES"
.PP
\fBprimesieve 1000\fR
.RS 4
Count the primes <= 1000\&.
.RE
.PP
\fBprimesieve 1e6 \-\-print\fR
.RS 4
Print the primes <= 10^6\&.
.RE
.PP
\fBprimesieve 2^32 \-\-print=2\fR
.RS 4
Print the twin primes <= 2^32\&.
.RE
.PP
\fBprimesieve 1e16 \-\-dist=1e10 \-\-threads=1\fR
.RS 4
Count the primes inside [10^16, 10^16 + 10^10] using a single thread\&.
.RE
.SH "HOMEPAGE"
.sp
https://github\&.com/kimwalisch/primesieve
.SH "AUTHOR"
.sp
Kim Walisch <kim\&.walisch@gmail\&.com>
@@ -0,0 +1,114 @@
primesieve(1)
=============

NAME
----
primesieve - generate prime numbers

SYNOPSIS
--------
*primesieve* [_START_] _STOP_ [_OPTION_]...

DESCRIPTION
-----------
Generate the prime numbers and/or prime k-tuplets inside [START, STOP]
(< 2\^64) using the segmented sieve of Eratosthenes. primesieve includes a
number of extensions to the sieve of Eratosthenes which further improve
performance: multiples of small primes are pre-sieved, it uses wheel
factorization to skip multiples with small prime factors and it uses the bucket
sieve algorithm which improves cache efficiency when sieving > 2^32. primesieve
is also multi-threaded, it uses all available CPU cores by default for counting
primes and for finding the nth prime.

The runtime complexity of the segmented sieve of Eratosthenes is O(n log log n)
operations and it uses O(n\^(1/2)) memory. More specifically primesieve uses 8
bytes per sieving prime, hence its memory usage can be approximated by
PrimePi(n^(1/2)) * 8 bytes (per thread).

OPTIONS
-------

*-c*[_NUM+_]::
*--count*[=_NUM+_]::
Count primes and/or prime k-tuplets, 1 \<= NUM \<= 6. Count primes: -c or
--count, count twin primes: -c2 or --count=2, count prime triplets: -c3 or
--count=3, ... You can also count primes and prime k-tuplets at the same
time, e.g. -c123 counts primes, twin primes and prime triplets.

*--cpu-info*::
Print CPU information: CPU name, frequency, number of cores, cache sizes, ...

*-d*::
*--dist*=_DIST_::
Sieve the interval [START, START + DIST].

*-h*::
*--help*::
Print this help menu.

*-n*::
*--nth-prime*::
Find the nth prime, e.g. 100 -n finds the 100th prime. If 2 numbers _N_
_START_ are provided finds the nth prime > START, e.g. 2 100 -n finds the 2nd
prime > 100.

*--no-status*::
Turn off the progressing status.

*-p*[_NUM_]::
*--print*[=_NUM_]::
Print primes or prime k-tuplets, 1 \<= NUM \<= 6. Print primes: -p,
print twin primes: -p2, print prime triplets: -p3, ...

*-q*::
*--quiet*::
Quiet mode, prints less output.

*-s*::
*--size*=_SIZE_::
Set the size of the sieve array in KiB, 8 \<= SIZE \<= 4096. By default
primesieve uses a sieve size that matches your CPU's L1 cache size or half of
your CPU's L2 cache size (per core). This setting is crucial for performance,
on exotic CPUs primesieve sometimes fails to determine the CPU's cache sizes
which usually causes a big slowdown. In this case you can get a significant
speedup by manually setting the sieve size to the CPU's L1 or L2 cache size
(per core).

*--test*::
Run various sieving tests.

*-t*::
*--threads*=_NUM_::
Set the number of threads, 1 \<= NUM \<= CPU cores. By default primesieve
uses all available CPU cores for counting primes and for finding the nth
prime.

*--time*::
Print the time elapsed in seconds.

*-v*::
*--version*::
Print version and license information.

EXAMPLES
--------

**primesieve 1000**::
Count the primes \<= 1000.

**primesieve 1e6 --print**::
Print the primes \<= 10^6.

**primesieve 2^32 --print=2**::
Print the twin primes \<= 2^32.

**primesieve 1e16 --dist=1e10 --threads=1**::
Count the primes inside [10\^16, 10\^16 + 10^10] using a single thread.

HOMEPAGE
--------
https://github.com/kimwalisch/primesieve

AUTHOR
------
Kim Walisch <kim.walisch@gmail.com>

0 comments on commit 5ffbef1

Please sign in to comment.
You can’t perform that action at this time.