Ulam Spiral Calculator
Free online ulam spiral 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.
中文版:乌拉姆螺旋在线计算器
原理
乌拉姆螺旋:把 1 起始的自然数按方形螺旋排进网格、标出素数,素数会惊人地聚在对角线上——乌拉姆 1963 年在无聊的会议上涂画发现。对角线对应二次多项式(如 4k²+2k+1 型)的取值,而这类多项式产素数的能力异常突出。
本工具生成 n×n 螺旋,统计两条主对角线(去重后 2n−1 格)上的素数占比,与全体占比对照:n = 21 时对角线 43.902439024390% 对全体 19.274376417234%,富集约 2.3 倍。
使用步骤
① 输入奇数边长 n;② 得到对角线与全体素数占比对照;③ 增大 n 观察富集比趋于稳定(对角线多项式的素数密度优势)。
计算示例
n = 5:对角线 9 格(1、3、5、7、9、13、17、21、25)中素数 5 个(55.6%),全体 25 格中素数 9 个(36%);n = 21(441 格):素数 85 个,对角线 41 格中 18 个素数。
注意事项
欧拉多项式 k² + k + 41 在 k = 0…39 连续 40 个素数是这一现象的极端展示(k = 40 时 41² 合数)。对角线富集源于二次多项式判别式的类数性质,尚无完全解释。
常见问题
Q:为什么方形螺旋而不是圆形?A:方形螺旋的对角线恰好对应整系数二次多项式,素数分布的偏斜因此可读;其他排布(如螺旋三角形)呈现不同但不那么显著的图案。
Q:更大 n 会怎样?A:n = 201(40401 格)对角线富集约 2 倍上下波动;素数定理保证全体占比按 1/ln(n²) 衰减,而对角线多项式的巴克达尔-哈尔伯兰定理保证其占比乘以 ln 的极限存在。
参考值区(同源数值校验)
n = 21:素数总数 85(π(441))、对角线 41 格含素数 18 个;n = 5:对角线 9 格 5 素数(3、5、7、13、17)。
How to use the Ulam Spiral 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 Ulam Spiral 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-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.