Ticket #11516 (new defect)

Opened 2 years ago

Last modified 2 years ago

zeta in modular integer ring is primitive

Reported by: kedlaya Owned by: was
Priority: major Milestone: sage-5.10
Component: number theory Keywords: modular arithmetic
Cc: kcrisman Work issues:
Report Upstream: N/A Reviewers:
Authors: Kiran Kedlaya Merged in:
Dependencies: Stopgaps:

Description

Karl-Dieter Crisman (at Sage Edu Days 3) points out that the documentation of the zeta method for a modular integer ring is a bit misleading.

sage: R = IntegerModRing(11)
sage: R.zeta(5, all=True)
[9, 5, 4, 3]

All well and good, but the documentation says:

       Return an n-th root of unity in self if there is one, or raise an
       ArithmeticError otherwise.
    
       INPUT:
    
       * ``n`` -- positive integer
    
       * ``all`` -- bool, default: False.  If True, return a list of all
         n-th roots of 1.

The point is that "n-th root of 1" should be "primitive n-th root of 1".

Change History

comment:1 Changed 2 years ago by kcrisman

Just a question - what happens for (say) n=4? Does it give two or three answers if one exists? (I'm really asking if it gives all non-1 roots, or truly only primitive roots.)

comment:2 Changed 2 years ago by kedlaya

It only returns the primitive roots:

sage: R = IntegerModRing(13)
sage: R.zeta(4, all=True)
[8, 5]

This is even true in corner cases:

sage: R = IntegerModRing(13)
sage: R.zeta(1, all=True)
[1]
sage: R = IntegerModRing(1)
sage: R.zeta(1, all=True)
[0]

comment:3 Changed 2 years ago by kedlaya

  • Keywords modular arithmetic added
  • Priority changed from minor to major

Hold on a second. What if the modulus is composite?

sage: R = IntegerModRing(8)
sage: R.zeta(2, all=True)
[7]

Shouldn't this return [3, 5, 7] instead?

Note: See TracTickets for help on using tickets.