1MATHO-PRIMES(1) Mathomatic Utilities MATHO-PRIMES(1)
2
3
4
6 matho-primes - generate consecutive prime numbers
7
8
10 matho-primes [start [stop] or "all"] ["twin"] ["pal" [base]]
11 matho-primes [-htuv] [-c count] [-m number] [-p base] [start [stop]]
12
13
15 This command-line utility is optionally part of the mathomatic(1) pack‐
16 age. It quickly computes any number of consecutive prime numbers using
17 a windowing, memory efficient sieve of Eratosthenes algorithm, dumping
18 them to standard output. They are displayed one prime per line in
19 ascending order, unless the "twin" option is specified, which displays
20 only twin primes, two primes per line.
21
22 Generates up to 18 decimal digit primes, or whatever is the number of
23 digits of precision for a floating point long double in the C compiler
24 used to compile this utility. Note that this utility might be compiled
25 to use only double precision floating point, if long double precision
26 is not fully supported by the C compiler or hardware, allowing at most
27 15 decimal digit primes in that case.
28
29 Ways to verify that this utility is working are to pipe the output into
30 the Unix "factor" utility, or compare the output with the BSD Games
31 "primes" utility, using the supplied shell script: examples/testprimes.
32
33 All numbers displayed by this utility are decimal (base 10) prime num‐
34 bers. A prime number is an integer that cannot be factored.
35
36 A range may be specified on the command line, otherwise the starting
37 number and the number of primes to output is prompted for. The range
38 is start to stop inclusive, and stop must be greater than or equal to
39 start.
40
41 If the -c option is specified, the number of lines of primes displayed
42 is limited to the decimal count that follows this option.
43
44 If the -t or "twin" option is specified on the command line, only twin
45 primes will be displayed. Twin primes are two primes that differ in
46 value by 2. Each twin pair is displayed together on the same line sep‐
47 arated by a space character.
48
49 If the -p or "pal" option is specified on the command line, only palin‐
50 dromic primes are displayed. Palindromes are symmetrical, they read
51 exactly the same forward and backward. The palindromic number base may
52 be specified, the default is base 10. The base can be any integer
53 greater than 1. Primes are always displayed in decimal (base 10).
54
55 The version number and short help on the allowed command-line parame‐
56 ters and usage information are displayed when given the -h option.
57
58 With the -u option, all output (standard output and standard error out‐
59 put) is set to be unbuffered, making all output happen immediately,
60 instead of when the output buffer is full or when the program termi‐
61 nates or waits for input.
62
63 The -m option changes the memory size of the prime number sieve window.
64 It is followed by a decimal, floating point number which is a multi‐
65 plier of the default window size (2 megabytes). It is possible that
66 changing the memory size may speed up the total run time a bit; other‐
67 wise there is no reason to use this option, and its use is not recom‐
68 mended.
69
70 The -v option simply displays the program name and version number, and
71 then exits successfully.
72
73
75 George Gesslein II (gesslein@mathomatic.org) at "http://www.math‐
76 omatic.org".
77
78
80 If you find a bug, please report it to the author or at
81 "https://launchpad.net/mathomatic".
82
83
85 rmath(1), mathomatic(1), primorial(1), matho-mult(1), matho-sum(1),
86 matho-pascal(1), matho-sumsq(1)
87
88
89
90Mathomatic MATHO-PRIMES(1)