0 should not be a primitive root

101 views
Skip to first unread message

Will Song

unread,
Aug 14, 2017, 3:00:17 PM8/14/17
to sage-devel
Not sure if this is a known bug or not.

SageMath version 8.0, Release Date: 2017-07-21

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

The easy fix would just be to add

if self == 0:
    return True

after https://github.com/sagemath/sage/blob/master/src/sage/rings/finite_rings/integer_mod.pyx#L1586. This also fixes the issue with p^j being a primitive root mod p^k where p is an odd prime.

Daniel Krenn

unread,
Aug 16, 2017, 5:00:41 AM8/16/17
to sage-...@googlegroups.com

Will Song

unread,
Aug 16, 2017, 11:41:23 AM8/16/17
to sage-devel
Thanks for catching my mistake it should indeed be False instead of True.
Reply all
Reply to author
Forward
0 new messages