diff options
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/algebra/numtheor.spad.pamphlet | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5919c53a..5f7308ec 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2008-05-18 Martin Rubey <martin.rubey@univie.ac.at> + + Fix AW/340 + * algebra/numtheor.spad.pamphlet + (divisors$IntegerNumberTheoryFunctions): Fix thinko. + 2008-05-18 Gabriel Dos Reis <gdr@cs.tamu.edu> * algebra/alql.spad.pamphlet (IndexCard): Don't use pretend. diff --git a/src/algebra/numtheor.spad.pamphlet b/src/algebra/numtheor.spad.pamphlet index 1071d36d..6954e930 100644 --- a/src/algebra/numtheor.spad.pamphlet +++ b/src/algebra/numtheor.spad.pamphlet @@ -435,16 +435,15 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where numer(n * r) divisors n == - oldList : List Integer := concat(1,nil()) - newList : List Integer + oldList : List Integer := [1] for f in factors factor n repeat - newList := nil() - for k in 0..f.exponent repeat + newList := oldList + for k in 1..f.exponent repeat pow := f.factor ** k for m in oldList repeat newList := concat(pow * m,newList) oldList := newList - sort(#1 < #2,newList) + sort(#1 < #2,oldList) numberOfDivisors n == n = 0 => 0 |