% factors.m
%  Find and print the prime factorization of N.
%
n = input ( '  Enter the value of N > 1 to factorize: ' );

if ( n < 1 )
  error ( '  N must be greater than 1.' )
end  

i = 2;        % Our first possible factor.


while ( 1 < n )
  while ( mod ( n, i ) == 0 )
    n = n / i;
    fprintf ( ' %d', i );
  end
  i = i + 1;
end
fprintf ( '\n' );

