MathTop

primitive_root 函数

返回模 m 的原根;不存在时给出错误。

语法

  • NumberTheory:-PrimitiveRoot(m)
  • PrimitiveRoot(m)
  • PrimitiveRoot(m, greaterthan = n)
  • PrimitiveRoot(m, ith = k)
  • primitive_root(m)
  • primroot(m)

参数与选项

m正模数。
greaterthan可选下界;返回大于该值的第一个原根。
ith可选一基序号;按递增原根列表取第 k 个值。

示例

  1. 原根primitive_root(17)返回 3。
  2. 下界选项PrimitiveRoot(17, greaterthan = 5)返回 6。
  3. 按序号取原根PrimitiveRoot(17, ith = 2)返回 5。