Skip to content

fix bugs in is_prime #5496

@williamstein

Description

@williamstein

This is not good:

sage: is_prime(GF(5)(3))
True
sage: is_prime(GF(5)(4))
False

The fix is to totally 100% rewrite is_prime in arith.py so that it first calls x.is_prime() and if that isn't defined, then in some special cases (e.g., python ints) converts to Integer and calls is_prime. Otherwise, it raises a NotImplementedError.

Component: number theory

Author: Kevin Stueve

Reviewer: Sebastian Pancratz

Merged: sage-4.3.1.rc1

Issue created by migration from https://trac.sagemath.org/ticket/5496

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions