Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes


top source mg_factor

result = mg_factor(n)

Returns the prime factorization of a given integer value n. If the input is prime, returns the value itself.

Return value

integer array of factors, the same type as the input n


n in required type=integer type

value to factor


The following are factorizations of values:

IDL> print, mg_factor(2*27*5) 2 3 3 3 5 IDL> print, mg_factor(13) 13

File attributes

Modification date: Thu May 17 10:39:19 2012
Lines: 42
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.