Mercurial > hg > octave-avbm
changeset 10476:f261f936bf36
use rem for divisibility check in factor
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 30 Mar 2010 21:04:27 +0200 |
parents | 739109ef88ee |
children | a9649f994b07 |
files | scripts/ChangeLog scripts/specfun/factor.m |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-03-30 Jaroslav Hajek <highegg@gmail.com> + + * specfun/factor.m: Use rem to check divisibility. + 2010-03-27 Ben Abbott <bpabbot@mac.com> * plot/__go_draw_figure__.m: Untabify.
--- a/scripts/specfun/factor.m +++ b/scripts/specfun/factor.m @@ -62,8 +62,7 @@ p = primes (sqrt (n)); while (n > 1) ## Find prime factors in remaining n. - q = n ./ p; - p = p (q == fix (q)); + p = p (rem (n, p) == 0); if (isempty (p)) ## Can't be reduced further, so n must itself be a prime. p = n;