(1) -> prime?(0::SUP INT)

   (1)  true

(2) -> prime?(((x-1)^2)::SUP INT)

   (2)  true


prime$SUP INT is implemented in UFD.
The implementation clearly overlooked a few things.


On a related subject, is it intentional that "factor" of
POLY INT does not factor the coefficient?

(3) -> factor((6*(x-1)^2)::POLY INT)

                 2
   (3)  6 (x - 1)

- Qian


diff --git a/src/algebra/catdef.spad b/src/algebra/catdef.spad
index 262ba2ba..109671c8 100644
--- a/src/algebra/catdef.spad
+++ b/src/algebra/catdef.spad
@@ -1532,7 +1532,10 @@
   squareFreePart x ==
       unit(s := squareFree x) * _*/[f.factor for f in factorList s]

-  prime? x == numberOfFactors factor x = 1
+  prime? x ==
+      zero? x => false
+      f := factorList factor x
+      # f = 1 and first(f).exponent = 1

 --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
 --All rights reserved.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/fricas-devel/a8197304-d3a1-4e7f-abef-cc17bfee7647%40gmail.com.

Reply via email to