Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

FACTOR(6)  —  UNIX Programmer’s Manual

NAME

factor, primes − factor a number, generate large primes

SYNOPSIS

factor [ number ]

primes

DESCRIPTION

When factor is invoked without an argument, it waits for a number to be typed in.  If you type a positive number less than231−1 (about2.1×109), it will factor the number and print its prime factors; each one is printed the proper amount of times.  Then it waits for another number.  It exits if it encounters a zero or any non-numeric character. 

If factor is invoked with an argument, it factors the number as above and then exits. 

Maximum time to factorn is proportional to√n and occurs whenn is prime or the square of a prime. 

When primes is invoked, it waits for a number to be typed in.  If you type in a number less than, it will print all the primes less than or equal to this number. 

DIAGNOSTICS

‘Ouch.’ for input out of range or garbage input. 

7th Edition

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026