11.1.1 Prime_Factors_Math_Utils Procedure

The Prime_Factors_Math_Utils procedure returns a vector of the prime
factors for a given number. For negative numbers, it returns a vector
with ``-1'' in the first position and then the prime factorization
for the corresponding positive number. For zero, it returns a single
zero as the prime factorization. The procedure gives correct answers
for all integers in the range [`-HUGE(),HUGE()`].

Calling syntax:

call Prime_Factors (Number, NFactors, Factors, Verbose) |

Input variables:

Number |
The number to be factored. | ||

Verbose |
Toggle for output. Default is false. [optional] |

Output variables:

NFactors |
The number of prime factors. | ||

Factors(32) |
A vector of the prime factors. |

The Prime_Factors_Math_Utils code listing contains additional documentation.

Michael L. Hall