Opened 4 years ago

Closed 4 years ago

#23624 closed defect (fixed)

0 should not be a primitive root

Reported by: dkrenn Owned by:
Priority: major Milestone: sage-8.1
Component: number theory Keywords:
Cc: Merged in:
Authors: Daniel Krenn, Will Song Reviewers: Daniel Krenn, David Roe
Report Upstream: N/A Work issues:
Branch: a24534f (Commits, GitHub, GitLab) Commit: a24534f5384896ee13b96136768da8d25c83edfe
Dependencies: Stopgaps:

Status badges


sage: mod(0, 17).is_primitive_root()

should return False.

This also fixes the issue with p^j being a primitive root mod p^k where p is an odd prime.

Reported by Will Song at

Change History (8)

comment:1 Changed 4 years ago by dkrenn

  • Branch set to u/dkrenn/primitiv-root-0

comment:2 Changed 4 years ago by dkrenn

  • Commit set to 121fab6ddaeed58685a324c69407c477bd73e060

I think 0 is considered a primitive root mod 1.

New commits:

b9f29b70 is not a primitiv root mod n
d1e742a0 is primitiv root mod 1
121fab6add doctests

comment:3 Changed 4 years ago by dkrenn

  • Authors set to Daniel Krenn, Will Song

comment:4 Changed 4 years ago by git

  • Commit changed from 121fab6ddaeed58685a324c69407c477bd73e060 to a24534f5384896ee13b96136768da8d25c83edfe

Branch pushed to git repo; I updated commit sha1. New commits:

a24534fprimitive root p^j mod p^k

comment:5 Changed 4 years ago by dkrenn

  • Reviewers set to Daniel Krenn
  • Status changed from new to needs_review

LGTM (modulo patchbot), however, I think a second reviewer should have a look (I created this patch out of the fix proposed on the sage-devel mailing list)

comment:6 Changed 4 years ago by roed

  • Reviewers changed from Daniel Krenn to Daniel Krenn, David Roe

Fine with me as well, subject to tests succeeding.

comment:7 Changed 4 years ago by dkrenn

  • Status changed from needs_review to positive_review

comment:8 Changed 4 years ago by vbraun

  • Branch changed from u/dkrenn/primitiv-root-0 to a24534f5384896ee13b96136768da8d25c83edfe
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.