'\" te .\" Copyright 1989 AT&T Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved .TH factor 1 "31 Jan 1996" "SunOS 5.11" "User Commands" .SH NAME factor \- obtain the prime factors of a number .SH SYNOPSIS .LP .nf \fBfactor\fR [\fIinteger\fR] .fi .SH DESCRIPTION .sp .LP \fBfactor\fR writes to standard input all prime factors for any positive integer less than or equal to 10^14. The prime factors are written the proper number of times. .sp .LP If \fBfactor\fR is used \fIwithout\fR an argument, it waits for an integer to be entered. After entry of the integer, it factors it, writes its prime factors the proper number of times, and then waits for another integer. \fBfactor\fR exits if a 0 or any non-numeric character is entered. .sp .LP If \fBfactor\fR is invoked \fIwith\fR an argument (\fIinteger\fR), it writes the integer, factors it and writes all the prime factors as described above, and then exits. If the argument is 0 or non-numeric, \fBfactor\fR writes a 0 and then exits. .sp .LP The maximum time to factor an integer is proportional to sqrt(n), where \fIn\fR is the integer which is entered. \fBfactor\fR will take this time when \fIn\fR is prime or the square of a prime. .SH OPERANDS .sp .ne 2 .mk .na \fB\fIinteger\fR\fR .ad .RS 11n .rt Any positive integer less than or equal to 10^14. .RE .SH EXIT STATUS .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 5n .rt Successful completion. .RE .sp .ne 2 .mk .na \fB\fB1\fR\fR .ad .RS 5n .rt An error occurred. .RE .SH DIAGNOSTICS .sp .LP \fBfactor\fR prints the error message \fBOuch!\fR for input out of range or for garbage input. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Availabilitysystem/extended-system-utilities .TE .SH SEE ALSO .sp .LP \fBattributes\fR(5)