Wilsons Theorem Calculator
Free online wilsons theorem 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.
中文版:威尔逊定理素性判定计算器
原理:威尔逊定理:n ≥ 2 是素数当且仅当 (n−1)! ≡ n−1 (mod n)。素数时 1 到 n−1 的每个数都有唯一的模 n 逆元把自身配对成 1,只有 1 和 n−1 自配(x² ≡ 1 的解),乘积恰为 −1 ≡ n−1。合数(n > 4)时 (n−1)! 含 n 的真因子分解,被 n 整除,同余 0;n = 4 是唯一例外(3! = 6 ≡ 2)。
步骤:输入 n,工具用 BigInt 逐项累乘取模计算 (n−1)! mod n(避免天文数字阶乘),按同余结果分三类输出,并附解释。
示例:n = 7:6! mod 7 = 6 = n−1,素数;n = 5:4! mod 5 = 4,素数;n = 9:8! mod 9 = 0,合数;n = 11:10! mod 11 = 10;n = 97:96! mod 97 = 96。
注意事项:威尔逊定理是素数的「充要刻画」,理论上完美,但作为素性测试毫无效率——它需要 n−1 次模乘,而费马/米勒–拉宾测试只需对数次幂运算;n = 4 的同余值 2 既不是 0 也不是 3,别把它误判成素数;模乘中间值用 BigInt 保证 n 到 10⁶ 内无溢出。
相关:费马小定理工具是更快概率判定的起点;素数分类(盈亏完美)工具从因子和角度刻画整数;阶乘工具计算精确阶乘值;二次剩余工具的欧拉判据同样依赖模幂。
How to use the Wilsons Theorem Calculator
- Fill in the inputs with your own numbers — every field shows what it expects.
- The result updates instantly as you type; no "Calculate" click needed.
- Read the result card for the main figure, the step-by-step formula, and practical notes.
Frequently asked questions
Is the Wilsons Theorem 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.
KevinContent LeadCalcton Editorial Team · Last updated 2026-10-02
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.