Opened 2 years ago
Last modified 2 years ago
#23577 new defect
is_squarefree
Reported by: | roed | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.1 |
Component: | basic arithmetic | Keywords: | |
Cc: | saraedum, caruso, kedlaya, alina | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage: is_squarefree(6/1) True sage: is_squarefree(12/1) False sage: is_squarefree(2/3) False sage: (2/3).is_squarefree() Traceback (most recent call last): ... AttributeError: 'sage.rings.rational.Rational' object has no attribute 'is_squarefree'
The implementation of the global is_squarefree
method eventually uses return all(r[1] == 1 for r in factor(n))
. A more mathematically sensible definition is that x
is squarefree if and only if it is not divisible by the square of any non-unit. For fields, this means that 0
is not squarefree and everything else is squarefree.
Of course, this can be confusing for beginners who now have to deal with (4/1).is_squarefree()
returning True
.
See also #23510.
Change History (2)
comment:1 Changed 2 years ago by
- Cc saraedum caruso kedlaya added
comment:2 Changed 2 years ago by
- Cc alina added
Note: See
TracTickets for help on using
tickets.