FACTORS Name
FACTORS
Purpose
This function calculates the prime factors of natural number.
Category
Mathematics
Calling Sequence
Result = FACTORS( X )
Inputs
X: A positive number, of type integer, to be factored.
Output
Result: A vector containing the factors of X.
Uses
PRODUCT.pro
Procedure
This function recursively tries dividing the input number by
factors until it finally has them all.
Example
Calculate the factors of 28.
result = factors( 28 )
Returns [2,2,7]
Modification History
Written by: Daithi A. Stone, 2000-08-24.