factor2.m

Version 1.0.0.0 (554 Bytes) by David Terr
factor2(n) returns the prime factorization of n as a k by 2 matrix.
2.8K Downloads
Updated 26 May 2004

No License

Given a nonnegative integer n, factor2(n) returns the prime factorization of n as a 2 by k matrix, with the k distinct prime factors in the left column and exponents in the right column.

Cite As

David Terr (2026). factor2.m (https://uk.mathworks.com/matlabcentral/fileexchange/4966-factor2-m), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R12
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Discrete Math in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0

I modified this program so that it sorts the prime factors by columns instead of by rows, allowing for more convenience, especially with large numbers. I also modified it so it now works with negative numbers as well.