factor

Returns the prime factorization of X. If two outputs are requested, returns the unique primes of X.

Syntax

factor(X)

Inputs

X
Integer to be factored.
Type: double | integer
Dimension: scalar

Outputs

R, n
Prime factors of X.

Examples

Simple factor example:

factor(14)
R = [ 2 7 ]

Multiple output factor example:

[a,b]=factor(12)
disp(a)
disp(b)
a = [ 2 3 ]
b = [ 2 1 ]