xref: /dflybsd-src/games/factor/factor.6 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino.\" Copyright (c) 1989, 1993
2*86d7f5d3SJohn Marino.\"	The Regents of the University of California.  All rights reserved.
3*86d7f5d3SJohn Marino.\"
4*86d7f5d3SJohn Marino.\" This code is derived from software contributed to Berkeley by
5*86d7f5d3SJohn Marino.\" Landon Curt Noll.
6*86d7f5d3SJohn Marino.\"
7*86d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without
8*86d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions
9*86d7f5d3SJohn Marino.\" are met:
10*86d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
11*86d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
12*86d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
13*86d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer in the
14*86d7f5d3SJohn Marino.\"    documentation and/or other materials provided with the distribution.
15*86d7f5d3SJohn Marino.\" 3. Neither the name of the University nor the names of its contributors
16*86d7f5d3SJohn Marino.\"    may be used to endorse or promote products derived from this software
17*86d7f5d3SJohn Marino.\"    without specific prior written permission.
18*86d7f5d3SJohn Marino.\"
19*86d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20*86d7f5d3SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*86d7f5d3SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*86d7f5d3SJohn Marino.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23*86d7f5d3SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*86d7f5d3SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25*86d7f5d3SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26*86d7f5d3SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*86d7f5d3SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28*86d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*86d7f5d3SJohn Marino.\" SUCH DAMAGE.
30*86d7f5d3SJohn Marino.\"
31*86d7f5d3SJohn Marino.\"	@(#)factor.6	8.1 (Berkeley) 5/31/93
32*86d7f5d3SJohn Marino.\"
33*86d7f5d3SJohn Marino.\" $FreeBSD: src/games/factor/factor.6,v 1.5.2.3 2003/01/26 02:54:56 keramida Exp $
34*86d7f5d3SJohn Marino.\" $DragonFly: src/games/factor/factor.6,v 1.3 2005/08/05 22:35:10 swildner Exp $
35*86d7f5d3SJohn Marino.\"
36*86d7f5d3SJohn Marino.\" By: Landon Curt Noll   chongo@toad.com,   ...!{sun,tolsoft}!hoptoad!chongo
37*86d7f5d3SJohn Marino.\"
38*86d7f5d3SJohn Marino.\"   chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
39*86d7f5d3SJohn Marino.\"
40*86d7f5d3SJohn Marino.Dd October 10, 2002
41*86d7f5d3SJohn Marino.Dt FACTOR 6
42*86d7f5d3SJohn Marino.Os
43*86d7f5d3SJohn Marino.Sh NAME
44*86d7f5d3SJohn Marino.Nm factor ,
45*86d7f5d3SJohn Marino.Nm primes
46*86d7f5d3SJohn Marino.Nd factor a number, generate primes
47*86d7f5d3SJohn Marino.Sh SYNOPSIS
48*86d7f5d3SJohn Marino.Nm
49*86d7f5d3SJohn Marino.Op Fl h
50*86d7f5d3SJohn Marino.Op Ar number ...
51*86d7f5d3SJohn Marino.Nm primes
52*86d7f5d3SJohn Marino.Op Fl h
53*86d7f5d3SJohn Marino.Op Ar start Op Ar stop
54*86d7f5d3SJohn Marino.Sh DESCRIPTION
55*86d7f5d3SJohn MarinoThe
56*86d7f5d3SJohn Marino.Nm
57*86d7f5d3SJohn Marinoutility will factor positive integers.
58*86d7f5d3SJohn MarinoWhen a number is factored, it is printed, followed by a
59*86d7f5d3SJohn Marino.Ql \&: ,
60*86d7f5d3SJohn Marinoand the list of factors on a single line.
61*86d7f5d3SJohn MarinoFactors are listed in ascending order, and are preceded by a space.
62*86d7f5d3SJohn MarinoIf a factor divides a value more than once, it will be printed more than once.
63*86d7f5d3SJohn Marino.Pp
64*86d7f5d3SJohn MarinoWhen
65*86d7f5d3SJohn Marino.Nm
66*86d7f5d3SJohn Marinois invoked with one or more arguments, each argument will be factored.
67*86d7f5d3SJohn Marino.Pp
68*86d7f5d3SJohn MarinoWhen
69*86d7f5d3SJohn Marino.Nm
70*86d7f5d3SJohn Marinois invoked with no arguments,
71*86d7f5d3SJohn Marino.Nm
72*86d7f5d3SJohn Marinoreads numbers, one per line, from standard input, until end of file or error.
73*86d7f5d3SJohn MarinoLeading white-space and empty lines are ignored.
74*86d7f5d3SJohn MarinoNumbers may be preceded by a single
75*86d7f5d3SJohn Marino.Ql + .
76*86d7f5d3SJohn MarinoNumbers are terminated by a non-digit character (such as a newline).
77*86d7f5d3SJohn MarinoAfter a number is read, it is factored.
78*86d7f5d3SJohn Marino.Pp
79*86d7f5d3SJohn MarinoThe
80*86d7f5d3SJohn Marino.Nm primes
81*86d7f5d3SJohn Marinoutility prints primes in ascending order, one per line, starting at or above
82*86d7f5d3SJohn Marino.Ar start
83*86d7f5d3SJohn Marinoand continuing until, but not including
84*86d7f5d3SJohn Marino.Ar stop .
85*86d7f5d3SJohn MarinoThe
86*86d7f5d3SJohn Marino.Ar start
87*86d7f5d3SJohn Marinovalue must be at least 0 and not greater than
88*86d7f5d3SJohn Marino.Ar stop .
89*86d7f5d3SJohn MarinoThe
90*86d7f5d3SJohn Marino.Ar stop
91*86d7f5d3SJohn Marinovalue must not be greater than the maximum.
92*86d7f5d3SJohn MarinoThe default and maximum value of
93*86d7f5d3SJohn Marino.Ar stop
94*86d7f5d3SJohn Marinois 4294967295 on 32-bit architectures
95*86d7f5d3SJohn Marinoand 18446744073709551615 on 64-bit ones.
96*86d7f5d3SJohn Marino.Pp
97*86d7f5d3SJohn MarinoWhen the
98*86d7f5d3SJohn Marino.Nm primes
99*86d7f5d3SJohn Marinoutility is invoked with no arguments,
100*86d7f5d3SJohn Marino.Ar start
101*86d7f5d3SJohn Marinois read from standard input and
102*86d7f5d3SJohn Marino.Ar stop
103*86d7f5d3SJohn Marinois taken to be the maximum.
104*86d7f5d3SJohn MarinoThe
105*86d7f5d3SJohn Marino.Ar start
106*86d7f5d3SJohn Marinovalue may be preceded by a single
107*86d7f5d3SJohn Marino.Ql + .
108*86d7f5d3SJohn MarinoThe
109*86d7f5d3SJohn Marino.Ar start
110*86d7f5d3SJohn Marinovalue is terminated by a non-digit character (such as a newline).
111*86d7f5d3SJohn Marino.Sh DIAGNOSTICS
112*86d7f5d3SJohn Marino.Bl -diag
113*86d7f5d3SJohn Marino.It "negative numbers aren't permitted"
114*86d7f5d3SJohn Marino.It "illegal numeric format"
115*86d7f5d3SJohn Marino.It "start value must be less than stop value"
116*86d7f5d3SJohn Marino.It "Result too large"
117*86d7f5d3SJohn Marino.El
118*86d7f5d3SJohn Marino.Sh BUGS
119*86d7f5d3SJohn Marino.Nm
120*86d7f5d3SJohn Marinocannot handle the
121*86d7f5d3SJohn Marino.Dq "10 most wanted"
122*86d7f5d3SJohn Marinofactor list,
123*86d7f5d3SJohn Marino.Nm primes
124*86d7f5d3SJohn Marinowill not get you a world record.
125