跳转到主要内容
Calcton

Primitive Roots Calculator

Free online primitive roots calculator. Enter your values and get instant results with the formula, step-by-step working, a worked example and FAQs — everything runs locally in your browser on Calcton, no signup required.

中文版:原根在线计算器

Primitive Roots Calculator
素数 p(3 ≤ p ≤ 10000)

原理

g 是模素数 p 的原根,指 g 的幂恰好跑遍模 p 的全部非零剩余(即 1 到 p−1 各一次),也就是 g 的阶(乘法周期)等于 p−1。判据:对 p−1 的每个素因子 q,都有 g^((p−1)/q) ≢ 1 (mod p)。原根个数恰为 φ(p−1)——本工具对每个候选 g 逐一验证该判据。

原根让离散对数变得自然:任何非零剩余都可写成 g^k, Diffie-Hellman 密钥交换与 ElGamal 签名都建立在「由 g^k 反推 k 很难」之上。不是所有模数都有原根:恰有原根的模数是 2、4、p^k、2p^k。

使用步骤

① 输入素数 p;② 得到全部原根、个数 φ(p−1) 与最小原根;③ 密码学应用通常直接取最小原根为生成元。

计算示例

p = 7:原根 3 与 5(φ(6) = 2 个);p = 11:原根 2、6、7、8(4 个);p = 13:原根 2、6、7、11;p = 97 的最小原根是 5。3^2 = 2、3^3 = 6、3^6 = 1 (mod 7)——阶恰为 6,故 3 是原根。

注意事项

p−1 的素因子分解是判据的前提(本工具内部枚举 q 验证);对大素数应先分解 p−1 再检验。合数模的「原根」定义相同但存在性需先查 2、4、p^k、2p^k 列表。

常见问题

Q:原根为什么总是成组出现?A:若 g 是原根,g^k 与 p 互素当且仅当 gcd(k, p−1) = 1,这样的 k 有 φ(p−1) 个,故原根成 φ(p−1) 个并可与指数一一对应。

Q:Artin 猜想和它有关吗?A:有关——Artin 常数猜想:对固定整数 a 非完全平方,a 是无穷多个素数的最小原根,密度约 0.3739。

参考值区(同源数值校验)

p = 7:原根 3、5;p = 11:原根 2、6、7、8(φ(10) = 4 个);p = 97 最小原根 5。

How to use the Primitive Roots Calculator

  1. Fill in the inputs with your own numbers — every field shows what it expects.
  2. The result updates instantly as you type; no "Calculate" click needed.
  3. Read the result card for the main figure, the step-by-step formula, and practical notes.

Frequently asked questions

Is the Primitive Roots Calculator free?

Yes — all math calculators on Calcton are free, with no sign-up required. Your inputs are processed in your browser and never sent to a server.

Is there a Chinese version of this tool?

Yes. Use the Chinese version link above — it is the same calculator with the interface in Simplified Chinese.

References

Formulas and benchmarks used by this calculator follow these published sources.

  1. dlmf.nist.gov
  2. mathworld.wolfram.com
Kevin's profile

KevinContent LeadCalcton Editorial Team · Last updated 2026-09-30

Kevin maintains Calcton's formula verification and content: every calculator cites the standard it implements, worked examples are recomputed programmatically, and health benchmarks follow WHO and international guidelines.

Related calculators

More in this category: Math calculators

About math calculators

Free online math calculators for algebra, statistics, number theory and everyday arithmetic — from quadratic equations and matrices to percentages, fractions and prime factorization, each with step-by-step formulas.

搜索计算器

搜索全站计算器、分类与页面,回车直达