第一道门·数字之门:素数的密语(The First Gate — The Door of Numbers: Whispers of the Primes)
第一道门·数字之门:素数的密语
The First Gate — The Door of Numbers: Whispers of the Primes
---
风从十二维的方向吹来。
The wind blew from the direction of the twelve dimensions.
林霄的脚离开地面的那一刻,他听见的不是风声,而是一串数字——像雨滴一样,从虚空中坠落,敲打他的耳膜。1,2,3,4,5……不,不是简单的正整数。那些声音是有重量的:1 是透明的,2 是银色的,3 是金色的,4 是灰色的——它听起来像一块被劈开的石头,里面竟然还藏着另一个 2。
The moment Lin Xiao's feet left the ground, what he heard was not the wind, but a string of numbers — falling like raindrops from the void, tapping against his eardrums. 1, 2, 3, 4, 5… No, they were not simple positive integers. Those sounds had weight: 1 was transparent, 2 was silver, 3 was golden, 4 was grey — it sounded like a stone that had been split open, only to reveal another 2 hidden inside.
"5 是完整的。" 一个声音在他耳边说,温柔而古老。"4 不是。"
"5 is whole," a voice said in his ear, gentle and ancient. "4 is not."
然后是坠落。
Then came the fall.
---
1.1 整除平原 / The Plain of Divisibility
他摔在了一片由数字铺成的平原上。
He crashed onto a plain paved with numbers.
地面不是泥土,也不是石头——是数。密密麻麻的数,从 1 开始,延伸到地平线消失的地方。它们像青草一样从地底长出来,每一株都是一个独立的数字,发出淡淡的光。1 几乎不发光,2 发出稳定的银辉,3 闪烁金光,4 灰暗地蜷缩着,像一朵没开好的花。
The ground was not soil, nor stone — it was numbers. Dense numbers, starting from 1, stretching to where the horizon disappeared. They grew from the earth like grass, each one an independent number, glowing faintly. 1 barely glowed, 2 emitted a steady silver light, 3 flickered with gold, 4 curled up dimly, like a flower that had not bloomed well.
"欢迎来到整除平原。" 那个声音再次响起。"我是埃拉托色尼。"
"Welcome to the Plain of Divisibility." The voice spoke again. "I am Eratosthenes."
林霄揉着被摔疼的屁股坐起来,看见一个透明的身影从数字草丛中浮起。那身影像是由无数根光线编织而成——每根光线都是一个数字,缠绕、交织、流动。他的脸看不清楚,但他的眼睛是两颗极小的水晶,一颗银,一颗金。
Lin Xiao sat up, rubbing his sore bottom, and saw a translucent figure rising from the numerical grass. The figure seemed woven from countless threads of light — each thread a number, entwined, interwoven, flowing. His face was unclear, but his eyes were two tiny crystals, one silver, one gold.
"埃拉……什么?" 林霄问。
"Eratos… what?" Lin Xiao asked.
"埃拉托色尼。" 那身影微微一笑。"古希腊人。公元前两百多年。我曾经用一双脚丈量过地球的周长。但在这里,我的职责是守护素数。"
"Eratosthenes." The figure smiled slightly. "An ancient Greek. More than two hundred years before the common era. I once measured the circumference of the Earth with my own feet. But here, my duty is to guard the primes."
"素数?" 林霄重复着这个词,他隐约记得中学课本里提过——但具体是什么,他的脑子一片模糊。
"Primes?" Lin Xiao repeated the word. He vaguely remembered it being mentioned in his middle school textbook — but what exactly it was, his mind was a blur.
"你脚下," 埃拉托色尼抬起一根由光线构成的手指,"那些发光的数字——你能看出它们的区别吗?"
"Under your feet," Eratosthenes raised a finger made of light, "those glowing numbers — can you see the difference between them?"
林霄低头。这一次他注意到了一些细节:2 的周围是干净的,没有其他数字依偎;3 也是。但 4 的脚下缠着 2,像藤蔓缠着树干;6 的脚下缠着 2 和 3;8 的脚下缠着 2、2、2;9 的脚下缠着 3、3。
Lin Xiao looked down. This time he noticed some details: around 2 it was clean, with no other numbers clinging to it; the same with 3. But at the foot of 4, a 2 was wrapped around it like a vine around a tree trunk; at the foot of 6, both 2 and 3; at 8, two, two, and two; at 9, three and three.
"看到了。" 林霄点点头。"有些数字是干净的,有些不是。"
"I see it." Lin Xiao nodded. "Some numbers are clean, some are not."
"干净的那些," 埃拉托色尼说,"就是素数。素数(prime number)是只能被 1 和它自己整除的自然数,且必须大于 1。"
"Those that are clean," said Eratosthenes, "are primes. A prime number is a natural number greater than 1 that is divisible only by 1 and itself."
$$\text{prime} \; p \iff p \in \mathbb{N},\; p > 1,\; \forall d \in \mathbb{N},\; (d \mid p \implies d = 1 \lor d = p)$$
"那么不干净的呢?"
"And the unclean ones?"
"它们是合数(composite number)。每个合数都能被拆成两个或更多比它小的整数的乘积。比如 4 = 2 × 2,6 = 2 × 3,8 = 2 × 2 × 2,9 = 3 × 3,10 = 2 × 5。"
"They are composite numbers. Every composite number can be broken into the product of two or more integers smaller than itself. For example, 4 = 2 × 2, 6 = 2 × 3, 8 = 2 × 2 × 2, 9 = 3 × 3, 10 = 2 × 5."
"那 1 呢?"
"And 1?"
"1 是特殊的," 埃拉托色尼说,"它既不是素数,也不是合数。它是单位元(unit),是所有整数的'基点'。在数论中,1 不能被拆解,也没有'非平凡因子'——这个术语我们后面会用到。"
"1 is special," said Eratosthenes. "It is neither prime nor composite. It is the unit, the 'base point' of all integers. In number theory, 1 cannot be broken down, and it has no 'non-trivial divisors' — we will use this term later."
林霄沉默了几秒钟。他突然觉得,自己过去十几年学的数学,似乎都被封印在了某种灰色的遗忘里——而此刻,每一句话都像钥匙,正在一扇一扇地打开他脑中的门。
Lin Xiao was silent for a few seconds. He suddenly felt that the mathematics he had learned over the past decade or so seemed to have been sealed in a grey oblivion — and at this moment, every word was like a key, opening door after door in his mind.
"为什么素数这么重要?" 他问。
"Why are primes so important?" he asked.
埃拉托色尼笑了。他的笑声像水波一样从他的身体向外扩散,让周围几个数字都跟着轻轻颤动。
Eratosthenes smiled. His laughter spread outward from his body like ripples in water, making the surrounding numbers tremble slightly.
"因为素数是原子的数学等价物(the mathematical equivalent of atoms)。" 他说。"宇宙中的一切物质由原子构成——氢、氧、碳、铁。自然数中的一切整数由素数构成——2、3、5、7、11……任何一个大于 1 的整数,都唯一地(uniquely)分解为若干素数的乘积。这就是著名的算术基本定理(Fundamental Theorem of Arithmetic)。"
"Because primes are the mathematical equivalent of atoms." he said. "All matter in the universe is composed of atoms — hydrogen, oxygen, carbon, iron. All integers in the natural numbers are composed of primes — 2, 3, 5, 7, 11… Every integer greater than 1 can uniquely be factored into a product of primes. This is the famous Fundamental Theorem of Arithmetic."
"唯一地?" 林霄抓住了这个词。"什么意思?"
"Uniquely?" Lin Xiao caught the word. "What does that mean?"
"意思是——" 埃拉托色尼从虚空中拉出一根光线,线的两端分别连着 12 和 18。"12 = 2 × 2 × 3,18 = 2 × 3 × 3。无论你怎么分解,无论你在哪个星系、哪个维度、用什么方法,只要是同一组素数相乘,顺序可以不同,但集合永远相同。这就是'唯一'。"
"It means —" Eratosthenes pulled a thread of light from the void, with its two ends connected to 12 and 18. "12 = 2 × 2 × 3, 18 = 2 × 3 × 3. No matter how you factor them, no matter which galaxy, which dimension, which method you use, as long as the same primes are multiplied, the order may differ, but the set is always the same. That is 'unique'."
"所以," 埃拉托色尼凝视着林霄,"如果你掌握了素数,你就掌握了整数的秘密。如果你掌握了整数的秘密,你就掌握了整除平原上所有力量的根源。"
"So," Eratosthenes gazed at Lin Xiao, "if you master the primes, you master the secret of integers. If you master the secret of integers, you master the source of all power on the Plain of Divisibility."
---
1.2 试炼开始:埃拉托色尼筛法 / The Trial Begins: The Sieve of Eratosthenes
"但要掌握它们," 埃拉托色尼话锋一转,"你得先学会找它们。"
"But to master them," Eratosthenes turned the conversation, "you must first learn to find them."
他挥了挥手。一阵风从平原的深处吹来,风里裹挟着无数细小的光点——那是 1 到 100 的所有自然数。它们在林霄面前排成了一面墙,一行十个,一共十行。
He waved his hand. A wind blew from the depths of the plain, carrying countless tiny points of light — all the natural numbers from 1 to 100. They lined up in a wall in front of Lin Xiao, ten per row, ten rows in total.
``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ```
"在这些数字中,哪些是素数?" 埃拉托色尼问。
"Among these numbers, which are primes?" Eratosthenes asked.
林霄皱起眉头。一百个数字,肉眼去找?他看了 30 秒,眼睛开始发酸。
Lin Xiao frowned. A hundred numbers, searching with the naked eye? After 30 seconds, his eyes began to ache.
"用笨办法不行," 埃拉托色尼仿佛读到了他的心思,"但用筛法(sieve method)可以。公元前 3 世纪,我发明了这个方法——后人叫它'埃拉托色尼筛法'(Sieve of Eratosthenes)。"
"Using the clumsy method won't work," Eratosthenes seemed to read his mind, "but using the sieve method will. In the 3rd century BCE, I invented this method — later generations called it the 'Sieve of Eratosthenes'."
"它的核心思想很简单:反证。我们不直接找素数,我们排除合数。剩下没被排除的,就是素数。"
"Its core idea is simple: proof by elimination. We do not find primes directly, we eliminate composites. Whatever remains uneliminated is a prime."
"怎么排除?"
"How to eliminate?"
"听好。我只说一遍。"
"Listen carefully. I will on