Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

factor(1) [opensolaris man page]

factor(1)							   User Commands							 factor(1)

NAME
factor - obtain the prime factors of a number SYNOPSIS
factor [integer] DESCRIPTION
factor 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. If factor is used without 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. factor exits if a 0 or any non-numeric character is entered. If factor is invoked with an 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, factor writes a 0 and then exits. The maximum time to factor an integer is proportional to sqrt(n), where n is the integer which is entered. factor will take this time when n is prime or the square of a prime. OPERANDS
integer Any positive integer less than or equal to 10^14. EXIT STATUS
0 Successful completion. 1 An error occurred. DIAGNOSTICS
factor prints the error message Ouch! for input out of range or for garbage input. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.11 31 Jan 1996 factor(1)

Check Out this Related Man Page

math::numtheory(3tcl)						 Tcl Math Library					     math::numtheory(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
math::numtheory - Number Theory SYNOPSIS
package require Tcl ?8.5? package require math::numtheory ?1.0? math::numtheory::isprime N ?option value ...? _________________________________________________________________ DESCRIPTION
This package is for collecting various number-theoretic operations, though at the moment it only provides that of testing whether an inte- ger is a prime. math::numtheory::isprime N ?option value ...? The isprime command tests whether the integer N is a prime, returning a boolean true value for prime N and a boolean false value for non-prime N. The formal definition of 'prime' used is the conventional, that the number being tested is greater than 1 and only has trivial divisors. To be precise, the return value is one of 0 (if N is definitely not a prime), 1 (if N is definitely a prime), and on (if N is proba- bly prime); the latter two are both boolean true values. The case that an integer may be classified as "probably prime" arises because the Miller-Rabin algorithm used in the test implementation is basically probabilistic, and may if we are unlucky fail to detect that a number is in fact composite. Options may be used to select the risk of such "false positives" in the test. 1 is returned for "small" N (which currently means N < 118670087467), where it is known that no false positives are possible. The only option currently defined is: -randommr repetitions which controls how many times the Miller-Rabin test should be repeated with randomly chosen bases. Each repetition reduces the probability of a false positive by a factor at least 4. The default for repetitions is 4. Unknown options are silently ignored. KEYWORDS
number theory, prime CATEGORY
Mathematics COPYRIGHT
Copyright (c) 2010 Lars Hellstrom <Lars dot Hellstrom at residenset dot net> math 1.0 math::numtheory(3tcl)
Man Page