MatLab program for factorization in 3 factors.

 

 

The MatLab program does the factorization of a number n in three factors in all possible ways, and writes the result along with the sum of the factors in a line.

To use write: nr(n)

 function nr = age(n)

 a=1;
nr=[0 0 0 0];

 while a*a*a<n
b=a;
while a*b*b <= n
if rem(n,(a*b)) == 0
age = [a b n/(a*b) (a+b+n/(a*b))];
nr=[nr' age'];
nr=nr';
end
b=b+1;
end
a=a+1;
end


© 1998 by Ingvar Jönsson