Code covered by the BSD License  

Highlights from
factor2

5.0

5.0 | 2 ratings Rate this file 3 Downloads (last 30 days) File Size: 1.37 KB File ID: #3944

factor2

by Brett Shoelson

 

08 Sep 2003 (Updated 10 Sep 2003)

Returns the factors (not only the prime factors) of positive integer k, including k itself.

| Watch this File

File Information
Description

%A = FACTOR2(K)
%Returns the factors (not only the prime factors) of k, including k itself.
%This complements the usage of TMW's factor function, which returns only
%prime factors.
%E.g., >> a=factor(1365), b=factor2(1365)
% ANS: a = 3 5 7 13
% b = 1 3 5 7 13 15 21 35 39 65 91 105 195 273 455 1365

%Written by Brett Shoelson, Ph.D.
%shoelson@helix.nih.gov
%9/10/01; updated 9/08/03.

%Tested under ML 6.5 and 6.1.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
03 Sep 2004 H R  
26 Apr 2006 M Khan

thank you.
I wonder why such a basic function is not available as a builtin MATLAB function. Even though it includes more complex function to deal with
LU, or triangular, factorization
Cholesky factorization
QR, or orthogonal, factorization
Incomplete factorizations
etc.

30 Apr 2008 dhiraj mahajan

Thanks a lot, it was very helpfull indeed.

Please login to add a comment or rating.
Updates
10 Sep 2003

Now includes function isinteger as a subfunction.

Tag Activity for this File
Tag Applied By Date/Time
factor prime Brett Shoelson 22 Oct 2008 07:07:16
k Brett Shoelson 22 Oct 2008 07:07:16
returns Brett Shoelson 22 Oct 2008 07:07:16
function Brett Shoelson 22 Oct 2008 07:07:16
mathematics Brett Shoelson 22 Oct 2008 07:07:16

Contact us at files@mathworks.com