diff options
author | rin <rin@NetBSD.org> | 2017-11-11 23:48:44 +0000 |
---|---|---|
committer | rin <rin@NetBSD.org> | 2017-11-11 23:48:44 +0000 |
commit | 38b4c167efba97445e3dffca780ccab4a3b7937a (patch) | |
tree | 1df8278af927ca703977cee63a684fac1591caa5 /factor/factor.6 | |
parent | 8426350b66a10201602aae2a0cf26ab6d65d1b4d (diff) | |
download | bsdgames-darwin-38b4c167efba97445e3dffca780ccab4a3b7937a.tar.gz bsdgames-darwin-38b4c167efba97445e3dffca780ccab4a3b7937a.tar.zst bsdgames-darwin-38b4c167efba97445e3dffca780ccab4a3b7937a.zip |
Add -h option to factor(6): duplicate factors are printed in
"human-readable" form of x^n.
Diffstat (limited to 'factor/factor.6')
-rw-r--r-- | factor/factor.6 | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/factor/factor.6 b/factor/factor.6 index c36fcb1f..d8c6df26 100644 --- a/factor/factor.6 +++ b/factor/factor.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: factor.6,v 1.13 2014/10/02 21:36:37 ast Exp $ +.\" $NetBSD: factor.6,v 1.14 2017/11/11 23:48:44 rin Exp $ .\" .\" Copyright (c) 1989, 1993 .\" The Regents of the University of California. All rights reserved. @@ -35,7 +35,7 @@ .\" .\" By Landon Curt Noll, http://www.isthe.com/chongo/index.html /\oo/\ .\" -.Dd May 15, 2010 +.Dd Nov 12, 2017 .Dt FACTOR 6 .Os .Sh NAME @@ -43,6 +43,7 @@ .Nd factor a number .Sh SYNOPSIS .Nm +.Op Fl h .Op Ar number ... .Sh DESCRIPTION The @@ -54,15 +55,20 @@ and the list of .Pq prime factors on a single line. Factors are listed in ascending order, and are preceded by a space. -If a factor divides a value more than once, it will be printed more than once. +By default, if a factor divides a value more than once, it will be +printed more than once. .Pp When .Nm -is invoked with one or more arguments, each argument will be factored. +is invoked with one or more +.Ar number +arguments, each argument will be factored. .Pp When .Nm -is invoked with no arguments, +is invoked with no +.Ar number +arguments, .Nm reads numbers, one per line, from standard input, until end of file or error. Leading white-space and empty lines are ignored. @@ -84,6 +90,15 @@ If .Nm is compiled without OpenSSL it is limited to the maximum value of .Vt unsigned long . +.Pp +The following option is available: +.Bl -tag -width flag +.It Fl h +If the +.Fl h +flag is specified, factors will be printed in "human-readable" format. +If a factor x divides a value n (>1) times, it will appear as x^n. +.El .Sh DIAGNOSTICS Out of range or invalid input results in an appropriate error message to standard error. |