🔍

首页Home › 数学工具Math

? 质数判定Number Primality Test

判断一个整数是否为质数:大整数(BigInt)运算,3.3×10^24 以下用确定性的 Miller–Rabin 测试,更大的数给出概率性结论。本地处理。Test whether an integer is prime, using big-integer (BigInt) arithmetic: a deterministic Miller–Rabin test below 3.3×10^24 and a probable-prime test above that. Processed locally.

使用说明与常见问题How-to & FAQ

「质数判定」是什么?What is the Number Primality Test tool?

判断一个整数是否为质数:大整数(BigInt)运算,3.3×10^24 以下用确定性的 Miller–Rabin 测试,更大的数给出概率性结论。本地处理。Test whether an integer is prime, using big-integer (BigInt) arithmetic: a deterministic Miller–Rabin test below 3.3×10^24 and a probable-prime test above that. Processed locally.

如何使用「质数判定」?How do I use the Number Primality Test tool?

在「质数判定」中,把内容粘贴或输入到上方输入框,结果会实时显示在下方,点击「复制结果」即可复制。In the Number Primality Test: Paste or type into the input box; the result appears below instantly — click "Copy result" to copy it.

能判定多大的数?How large can the number be?

最多 500 位的整数。负数、0 和 1 都不是质数,会直接说明。Integers of up to 500 digits. Negative numbers, 0 and 1 are not prime, and the page says so.

结果精确吗?用的是什么方法?Are the results exact? Which method is used?

整数按大整数(BigInt)处理,不经过浮点,也没有 32 位限制。先试除 1000 以内的质数;再用以 2 到 41 的 13 个质数为底的 Miller–Rabin 测试——这组底数对 3.3×10^24 以下的所有整数都是确定性的(只用到 37 的 12 个底数只对 3.18×10^23 以下成立,318665857834031151167461 就能骗过它们),所以在这个范围内“是质数 / 不是质数”都是严格结论(例如 3215031751、9007199254740991、4294967297 都正确判为合数,2^61−1 判为质数)。更大的数再做强 Lucas 检验(合起来就是 Baillie–PSW 检验),通过时显示“是质数(概率性判定)”:目前没有已知的反例,但这不是数学证明。判为“不是质数”的结论任何大小都是确定的。Yes for every "not prime" answer, and for "prime" below 3.3×10^24. The number is handled as a big integer (BigInt) with no floating-point step and no 32-bit limit. It is trial-divided by the primes below 1000 and then checked with a Miller–Rabin test using the 13 prime bases from 2 to 41, which is proven deterministic for every integer below 3.3×10^24 (the 12 bases up to 37 are only exact below 3.18×10^23; 318665857834031151167461 fools them) — so 3215031751, 9007199254740991 and 4294967297 are correctly reported as composite and 2^61−1 as prime. Larger numbers also get a strong Lucas test (together, the Baillie–PSW test); if they pass, the page says "probable prime": no counterexample is known, but it is not a mathematical proof. A "not prime" answer is certain at any size.

能写成 1,000 或 1e3 吗?Can I write 1,000 or 1e3?

千位分隔逗号(1,000)会去掉并提示;1e3 这样的指数写法、十六进制和小数会报错,请把整数完整写出。负号可以用 - 或 −。Thousands commas (1,000) are removed with a note; exponent forms such as 1e3, hex and decimals give an error, so write the integer out in full. The minus sign can be - or −.

「质数判定」免费吗?需要注册吗?Is the Number Primality Test free? Do I need an account?

「质数判定」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Number Primality Test is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.

相关工具Related tools

🔐 生成随机质数Generate Random Prime Numbers𝐹 生成斐波那契质数Generate Fibonacci Primes🎯 挑一个数Pick a Number🎲 随机数字矩阵Random Number Matrix🔀 打乱数字各位Shuffle Digits🔢 排序数字各位Sort Digits📝 分数百分比计算器Marks Percentage Calculator📉 函数绘图计算器Graphing Calculator➗ 分数与算式化简计算器Simplify Calculator (fractions & arithmetic)½ 百分比转分数计算器(精确)Percent to Fraction Calculator (exact)🔬 有效数字计算器(修约 / 计数)Significant Figures Calculator (round & count)⚾ 投手防御率 ERA(支持 6.1 局写法)ERA Calculator (with 6.1 innings notation)

← 全部工具All tools