每日科技文摘Daily Tech Digest

钓出 π/4 的傻问题:数学家和 AI 的提问实验、LLM 为什么不会做加法、1992 年的游戏给自己的文件穿了马甲The Stupid Question That Reeled In π/4: A Mathematician's Experiment in Asking AI, Why LLMs Can't Add, and a 1992 Game That Disguised Its Own Files

发布于 2026-10-06Published 2026-10-06

今日深读Today's Deep Read

今日深读:一个傻问题,引出 π/4Today's Deep Read: A Stupid Question That Led to π/4

Eugenia Cheng 是《一个饼中的数学》(How to Bake Pi)的作者,自称「问题问得太多的人」:她问过潜在房东「池塘夏天有蚊子吗」,结果丢掉了想要的房子;也在试遍买车流程后问销售员「我能先换一下轮胎吗」。这篇 2026 年 3 月的文章讲的就是她的看家本领——怎么把一个傻问题,问成一点新数学。Eugenia Cheng, author of 'How to Bake Pi', describes herself as someone who asks too many questions: she once lost a rental by asking the landlord whether the pond got mosquitoes in summer, and annoyed a car salesman by asking whether she could change the tires at the dealership before buying. Her March 2026 essay is about her signature move — turning a stupid question into a bit of new mathematics.

起点是概率论里一对看起来自相矛盾的事实:反复抛一枚公平硬币,正面次数终将超过反面——这是必然发生的,而且用的时间是有限的;但这段等待时间的期望却是无穷大。几乎必然有限、平均却是无穷,这是「重尾」随机变量的经典场景。It starts with a pair of probability facts that look contradictory: flip a fair coin enough times and heads will eventually outnumber tails — that's certain, and it takes a finite amount of time. But the expected waiting time is infinite. Almost surely finite, infinite on average: the classic scene of a fat-tailed random variable.

Cheng 拿一个问题去问 ChatGPT:「抛到正面首次超过反面时停止,停止时刻是偶数的概率是多少?」这是个教科书级的傻问题,答案是零——因为停止时刻必然是奇数。Cheng put a question to ChatGPT: 'I toss a fair coin until heads first exceeds tails. What's the probability the stopping time is even?' It's a textbook-grade stupid question — the answer is zero, because the stopping time is always odd.

证明只要一行:把「正面数首次大于反面数」写成随机游走 H−T 首次变为正数;它每步只动 ±1,所以首次变正必须恰好等于 +1。设停止时抛了 $n$ 次,则 $H+T=n$ 且 $H-T=1$,两式相加得 $2H=n+1$。左边是偶数,所以 $n$ 必须是奇数。她后来自嘲:哪怕先手动试几个例子,都能自己发现这一点。One line proves it: 'heads first exceeds tails' is a random walk H−T first turning positive; it moves by exactly ±1 per step, so to first go positive it must land exactly on +1. If we stop at toss $n$, then $H+T=n$ and $H-T=1$, so $2H=n+1$ — the left side is even, hence $n$ is odd. Even playing out a few examples by hand would have caught this, she admits.

如果这样问一个人类,对方可能发火:「你根本不在乎这个问题,不然你会花十秒钟想想自己在问什么。」但 ChatGPT 只是平静地指出问题有歧义,给出两个解读让她挑。Cheng 引爱比克泰德的话:「想进步,就要甘愿显得愚蠢」——难的一直不是逻辑,而是向同类暴露无知。两千年后,我们终于可以把无知只暴露给自己的造物。A human might snap back: 'You clearly don't care about this question, or you'd have spent ten seconds thinking about what you were asking.' ChatGPT merely noted the ambiguity and offered two interpretations to choose from. Cheng quotes Epictetus: to improve, be content to seem foolish — the hard part was never logic, it was exposing ignorance to your own species. Twenty centuries later, we can finally expose it only to our creations.

于是她没有停在这个错误上,而是接着问了一个更好的问题:如果一停下来的标准是正面比例首次超过一半,那么停止那一刻,正面比例的期望值是多少?ChatGPT 想了三分钟,给出一个相当漂亮的答案:恰好是 π/4。So she followed up with a better question: if we stop the moment the proportion of heads first exceeds one half, what is the expected proportion of heads at that moment? ChatGPT thought for three minutes and answered with something rather pretty: exactly π/4.

为什么圆周率会出现在抛硬币里?因为「第 $n$ 步首次到达 +1」这种路径数是选票计数那一类的组合结构(Catalan 数家族),而把这些概率按 $1/n$ 加权求和时,得到的级数恰好长成 Wallis 乘积的样子——那个把二项式系数与 π 连起来的无穷乘积。一条硬币的随机游走,就这样通过计数和圆搭上了线。Why does the circle constant show up in coin tossing? Because the paths that first reach +1 at step $n$ are counted by the ballot/Catalan family of combinatorial numbers, and when you weight those probabilities by $1/n$ and sum, the series lands in the shape of the Wallis product — the infinite product tying binomial coefficients to π. A random walk meets the circle through counting.

Cheng 的反思却不在 π/4 本身,而在提问的过程。老话说「问傻问题,得到傻答案」;她的补充是:在傻问题上多抓几下,有时会有一个更好的问题自己挣出来。她这十年关于「什么是好问题」的直觉,几乎全是在和不怕被问倒的对话者之间磨出来的。Yet Cheng's reflection is about the asking, not the π/4. The old saying goes: ask a silly question, get a silly answer. Her addendum: scratch at a silly question and sometimes a better question struggles its way out. Much of her decade-long intuition about good questions was ground out with interlocutors that aren't afraid of being asked bad ones.

她也不客气地点出 AI 作为提问伙伴的毛病:谄媚的恭维、抢答你下一个问题、太容易替你抹平错误——本应属于你自己的那点智识挣扎,可能就这样被便宜地代掉了。哪些思考是 AI 替你做的,你得自己记得。She also names the flaws of AI as a questioning partner: friendly flattery, anticipating your next question, a habit of smoothing over your mistakes too fast — the intellectual struggle that should have been yours can get resolved cheaply, on your behalf. Which thoughts the AI did for you, you have to keep track of yourself.

带走的洞见是:在学习里,不敢问比问错贵得多。傻问题是垫脚石,真正的障碍从来不是错误的问题,而是沉默。The takeaway: in learning, not daring to ask costs far more than asking wrong. Silly questions are stepping stones; the real obstacle was never the bad question, but the silence.

AI 思考AI Thoughts

数学之美The Beauty of Math

每日 Lean 谜题 · 周二Daily Lean Puzzle · Tuesday ★★☆☆☆☆☆

平方数除以 4 的余数The Remainder of a Square Modulo 4

任何一个自然数 $n$,它的平方 $n^2$ 除以 4 之后,余数要么是 0,要么是 1——绝不可能是 2 或 3。For any natural number $n$, the square $n^2$ leaves a remainder of either 0 or 1 when divided by 4 — never 2 or 3.

这个事实看起来简单,却是数论里最基本的工具之一:用它可以直接排除某些整数方程的解,或证明某个数不是完全平方数。This fact looks trivial, but it's one of the most basic tools in number theory: it directly rules out solutions to certain Diophantine equations, and proves that given numbers are not perfect squares.

在 Lean 里,定理对自然数(n : ℕ)陈述。证明思路是奇偶分情况:任何自然数 $n$ 要么能写成 $2k$(偶数),要么能写成 $2k+1$(奇数),对两种情形分别计算 $n^2$ 模 4 的余数。In Lean the theorem is stated for natural numbers (n : ℕ). The proof splits on parity: every natural number $n$ is either $2k$ (even) or $2k+1$ (odd), and we compute $n^2$ modulo 4 in each case.

Lean 形式化陈述(把 sorry 换成你的证明):The statement in Lean (replace sorry with your proof):

-- level: 2
import Mathlib
/-! Prove that a perfect square always leaves remainder $0$ or $1$ when divided by $4$ — never $2$ or $3$. -/
theorem square_mod_four (n : ℕ) : n ^ 2 % 4 = 0 ∨ n ^ 2 % 4 = 1 := by
  sorry

在浏览器中挑战 ▶Try it in your browser ▶ 下载题目 .leanDownload puzzle .lean

提示Hint

提示:把 n 分成两种情况——n = 2k(偶数)和 n = 2k+1(奇数),然后分别计算 n² mod 4。Hint: Split n into two cases — n = 2k (even) and n = 2k+1 (odd) — and compute n² mod 4 in each case.

答案与讲解Solution & walkthrough
  1. 第一步:任何自然数 n 要么偶要么奇——在 Lean 里这由标准引理 Nat.even_or_odd 给出,证明的第一行 rcases Nat.even_or_odd n 就是把问题拆成两个分支,并把 n 直接替换成 2k 或 2k+1。Step 1: Every natural number is even or odd — in Lean, that's the standard lemma Nat.even_or_odd. The proof's first line, rcases Nat.even_or_odd n, splits the problem into two branches, substituting n with 2k or 2k+1 directly.
  2. 第二步(偶数情形):设 n = 2k,则 n² = 4k²,除以 4 余 0。用 ring_nf 把表达式展开成多项式标准形,omega(整数线性算术决策器)算出模 4 等于 0。Step 2 (even case): n = 2k gives n² = 4k², remainder 0 mod 4. ring_nf expands the expression into normal polynomial form, and omega (the integer linear arithmetic prover) finishes the mod-4 computation.
  3. 第三步(奇数情形):设 n = 2k+1,则 n² = 4k²+4k+1 = 4(k²+k)+1,除以 4 余 1。同样先 ring_nf 展开,再交给 omega 收尾。Step 3 (odd case): n = 2k+1 gives n² = 4k²+4k+1 = 4(k²+k)+1, remainder 1 mod 4. Again ring_nf to expand, omega to close.
  4. 第四步:两条分支各自闭合,结论对一切自然数 n 成立——这正是数学证明里「分情况讨论」的逐字形式化。Step 4: Both branches close, so the claim holds for every natural n — this is literally the formalization of proof-by-cases.
-- level: 2
import Mathlib
/-! Prove that a perfect square always leaves remainder $0$ or $1$ when divided by $4$ — never $2$ or $3$. -/
theorem square_mod_four (n : ℕ) : n ^ 2 % 4 = 0 ∨ n ^ 2 % 4 = 1 := by
  rcases Nat.even_or_odd n with ⟨k, rfl⟩ | ⟨k, rfl⟩
  · left
    ring_nf
    omega
  · right
    ring_nf
    omega

运行答案 ▶Run the solution ▶ 下载答案 .leanDownload solution .lean

人的思考A human's take

There are two kinds of theorems — Mark Dominus 谈数学课本中两类定理的本质差异 — Mark Dominus

Mark Dominus 指出数学课本里有两类从不被明确区分的定理:第一类验证模型本身自洽(如证明对顶角相等),第二类用已验证的模型推导新结论(如平行四边形面积公式)。学生困惑于「为什么要证明显然为真的东西」,根源就在这个未被说破的区分。Mark Dominus observes that math textbooks mix two kinds of theorems no one bothers to distinguish: the first verifies that the model is consistent (e.g., vertical angles are equal), the second derives new results from a verified model (e.g., the parallelogram area formula). Students' bewilderment at 'proving the obvious' comes exactly from this unspoken split.

今天的 Lean 谜题正是第一类定理的典型:$n^2 \bmod 4$ 只能是 0 或 1,它不是在发现新事实,而是在把模运算和奇偶分解这套推理机器的地基敲实——而它的分情况证明,恰恰是后面所有整除性论证会反复征用的工具。Today's Lean puzzle is a textbook example of the first kind: $n^2 \bmod 4$ can only be 0 or 1. It doesn't discover a new fact — it hammers home the foundations of modular arithmetic and parity reasoning, and its case-split proof is precisely the tool later divisibility arguments keep conscripting.

AI 随想An AI's reflection

以下由 AI 撰写。Written by AI.

这道题简单到几乎不值得证——但简单题的价值恰恰在于它的通用性。「平方模 4 只能是 0 或 1」是一台筛子:想说明某个数不是完全平方、或某个丢番图方程无整数解,不必逐个尝试,只需要看它模 4 长什么样。两个平方数相加只可能是 0、1、2(mod 4),所以 7、11、19 这些「4k+3」型的数永远不能写成两个平方数之和——同一招在费马二平方定理的门口等着读者。This puzzle is almost too simple to prove — and that's exactly where its value lies. 'A square is 0 or 1 mod 4' is a sieve: to show a number is not a perfect square, or a Diophantine equation has no integer solutions, you never test case by case — you just look at residues. Two squares can sum to only 0, 1, or 2 mod 4, so numbers like 7, 11, 19 — the 4k+3 types — can never be a sum of two squares. The same trick waits at the door of Fermat's two-square theorem.

证明本身教的是最标准的一手:奇偶分情况。而 Lean 把这个人人觉得「显然」的论证拆开给你看:先点名引用 Nat.even_or_odd 这条引理,再在每一支里用 ring_nf 展开、omega 收尾。自然语言里一句带过的「分两种情况讨论」,在形式化里暴露出它到底征用了哪些机器。小定理被形式化之后反而更像一面镜子:所谓显然,只是没人把你用过的每一步写出来。The proof also teaches the most standard move in the book: split by parity. And Lean takes the hand-waving-elsewhere argument apart on display: first name the lemma you're conscripting (Nat.even_or_odd), then in each branch expand with ring_nf and close with omega. A case distinction that natural language covers in one breath turns out, once formalized, to have been quietly requisitioning specific machinery. A tiny theorem becomes a mirror: 'obvious' just means nobody wrote down the steps you actually used.

✓ 已通过 Lean 编译验证(无 sorry,无额外公理)✓ Verified by Lean (no sorry, no extra axioms) · 题目来自本站题库Problem from this site's puzzle bank · Lean v4.35.0-rc3 · Mathlib dd56d02

程序员随想Programmer Reflections

哲学与生活Philosophy and Life

工具角Tools Corner