Deleted Added
full compact
factor.6 (79754) factor.6 (104723)
1.\" Copyright (c) 1989, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Landon Curt Noll.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions

--- 20 unchanged lines hidden (view full) ---

29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\" @(#)factor.6 8.1 (Berkeley) 5/31/93
36.\"
1.\" Copyright (c) 1989, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Landon Curt Noll.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions

--- 20 unchanged lines hidden (view full) ---

29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\" @(#)factor.6 8.1 (Berkeley) 5/31/93
36.\"
37.\" $FreeBSD: head/games/factor/factor.6 79754 2001-07-15 07:53:42Z dd $
37.\" $FreeBSD: head/games/factor/factor.6 104723 2002-10-09 20:00:25Z fanf $
38.\"
39.\" By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
40.\"
41.\" chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
42.\"
38.\"
39.\" By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
40.\"
41.\" chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
42.\"
43.TH FACTOR 6 "Jan 7, 1999"
44.UC 7
45.SH NAME
46factor, primes \- factor a number, generate primes
47.SH SYNOPSIS
48.B factor
49-[h] [ number ] ...
50.PP
51.B primes
52-[h] [ start [ stop ]]
53.SH DESCRIPTION
43.Dd Oct 10, 2002
44.Dt FACTOR 6
45.Os
46.Sh NAME
47.Nm factor ,
48.Nm primes
49.Nd factor a number, generate primes
50.Sh SYNOPSIS
51.Nm
52.Op Fl h
53.Op Ar number ...
54.br
55.Nm primes
56.Op Fl h
57.Op Ar start Op Ar stop
58.Sh DESCRIPTION
54The
59The
55.I factor
56utility will factor integers between 0 and ULONG_MAX (4294967295 on 32
57bit architectures, 18446744073709551615 on 64 bit ones), inclusive.
58When a number is factored, it is printed, followed by a ``:'',
60.Nm
61utility will factor positive integers.
62When a number is factored, it is printed, followed by a
63.Dq \&: ,
59and the list of factors on a single line.
60Factors are listed in ascending order, and are preceded by a space.
64and the list of factors on a single line.
65Factors are listed in ascending order, and are preceded by a space.
61If a factor divides a value more than once, it will be printed
62more than once.
63.PP
66If a factor divides a value more than once, it will be printed more than once.
67.Pp
64When
68When
65.I factor
66is invoked with one or more arguments,
67each argument will be factored.
68.PP
69.Nm
70is invoked with one or more arguments, each argument will be factored.
71.Pp
69When
72When
70.I factor
73.Nm
71is invoked with no arguments,
74is invoked with no arguments,
72.I factor
75.Nm
73reads numbers, one per line, from standard input, until end of file or error.
74Leading white-space and empty lines are ignored.
76reads numbers, one per line, from standard input, until end of file or error.
77Leading white-space and empty lines are ignored.
75Numbers may be preceded by a single - or +.
78Numbers may be preceded by a single +.
76Numbers are terminated by a non-digit character (such as a newline).
77After a number is read, it is factored.
79Numbers are terminated by a non-digit character (such as a newline).
80After a number is read, it is factored.
78Input lines must not be longer than 255 characters.
79.PP
81.Pp
80The
82The
81.I primes
83.Nm primes
82utility prints primes in ascending order, one per line, starting at or above
84utility prints primes in ascending order, one per line, starting at or above
83.B start
85.Ar start
84and continuing until, but not including
86and continuing until, but not including
85.B stop.
87.Ar stop .
86The
88The
87.B start
89.Ar start
88value must be at least 0 and not greater than
90value must be at least 0 and not greater than
89.B stop.\&
91.Ar stop .
90The
92The
91.B stop
92value must not be greater than 4294967295.
93The default value of
94.B stop
95is 4294967295.
96.PP
93.Ar stop
94value must not be greater than the maximum.
95The default and maximum value of
96.Ar stop
97is 4294967295 on 32-bit architectures
98and 18446744073709551615 on 64-bit ones.
99.Pp
97When the
100When the
98.I primes
101.Nm primes
99utility is invoked with no arguments,
102utility is invoked with no arguments,
100.B start
101is read from standard input.
102.B Stop
103is taken to be 4294967295.
103.Ar start
104is read from standard input and
105.Ar stop
106is taken to be the maximum.
104The
107The
105.B start
108.Ar start
106value may be preceded by a single +.
107The
109value may be preceded by a single +.
110The
108.B start
111.Ar start
109value is terminated by a non-digit character (such as a newline).
112value is terminated by a non-digit character (such as a newline).
110The input line must not be longer than 255 characters.
111.SH OPTIONS
112.LP
113.TP 8
114.B \-h
115Print the results in hexadecimal rather than decimal.
116.SH DIAGNOSTICS
117Out of range or invalid input results in `ouch' being
118written to standard error.
119.SH BUGS
120.I Factor
121cannot handle the ``10 most wanted'' factor list,
122.I primes
113.Sh DIAGNOSTICS
114.Bl -item
115.It
116negative numbers aren't permitted
117.It
118illegal numeric format
119.It
120start value must be less than stop value
121.It
122Result too large
123.El
124.Sh BUGS
125.Nm
126cannot handle the
127.Dq 10 most wanted
128factor list,
129.Nm primes
123won't get you a world record.
130won't get you a world record.