advertisement

factor - obtain the prime factors of a number

Synopsis

Description

Operands

Exit Status

Diagnostics

Attributes

See Also

factor[integer]

advertisements

advertisements

factorwrites 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.

If

factoris usedwithoutan 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.factorexits if a 0 or any non-numeric character is entered.

If

factoris invokedwithan argument (integer), 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,factorwrites a 0 and then exits.

The maximum time to factor an integer is proportional to sqrt(n), where

nis the integer which is entered.factorwill take this time whennis prime or the square of a prime.

integerAny positive integer less than or equal to 10^14.

0Successful completion.

1An error occurred.

factorprints the error messageOuch!for input out of range or for garbage input.

See

attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE Availability SUNWesu

attributes(5)

SunOS 5.11 | factor (1) | 31 Jan 1996 |