🔺 杨辉三角(帕斯卡三角形)生成器Pascal's Triangle Generator
用大整数精确生成杨辉三角前 1–100 行(居中三角、左对齐或 CSV),或单独算出第 0–1000 行的全部二项式系数;还能显示奇偶图案,看到其中的谢尔宾斯基三角形。Generate the first 1–100 rows of Pascal's triangle exactly with big integers — centred, left-aligned or as CSV — or get every binomial coefficient in a single row from 0 to 1000. An odd/even view reveals the Sierpiński triangle inside it.
使用说明与常见问题How-to & FAQ
「杨辉三角(帕斯卡三角形)生成器」是什么?What is the Pascal's Triangle Generator tool?
用大整数精确生成杨辉三角前 1–100 行(居中三角、左对齐或 CSV),或单独算出第 0–1000 行的全部二项式系数;还能显示奇偶图案,看到其中的谢尔宾斯基三角形。Generate the first 1–100 rows of Pascal's triangle exactly with big integers — centred, left-aligned or as CSV — or get every binomial coefficient in a single row from 0 to 1000. An odd/even view reveals the Sierpiński triangle inside it.
如何使用「杨辉三角(帕斯卡三角形)生成器」?How do I use the Pascal's Triangle Generator tool?
在「杨辉三角(帕斯卡三角形)生成器」中,填写「模式」、「行数 n(1–100)」、「格式」、「行号 r(0–1000)」等参数,结果会随输入实时计算并显示在下方。In the Pascal's Triangle Generator: Fill in "Mode", "Rows, n (1–100)", "Format", "Row number, r (0–1000)"; results are recalculated instantly as you type.
杨辉三角是怎么构成的?How is Pascal's triangle built?
每行首尾都是 1,中间每个数等于它左上和右上两个数之和。第 r 行(从第 0 行算起)第 k 个数就是二项式系数 C(r, k),也就是 (a + b)ʳ 展开后各项的系数,所以第 r 行所有数之和是 2ʳ。Each row starts and ends with 1, and every other number is the sum of the two above it. Entry k of row r (counting from row 0) is the binomial coefficient C(r, k) — the coefficients of (a + b)ʳ — so row r adds up to 2ʳ.
为什么叫杨辉三角?Why is it also called Yang Hui's triangle?
南宋数学家杨辉在 1261 年的《详解九章算法》中记载了这个三角形,并注明出自北宋贾宪,比法国数学家帕斯卡(1654 年)早约 400 年,所以在中国称为杨辉三角或贾宪三角。The Song-dynasty mathematician Yang Hui recorded it in 1261, crediting the earlier Jia Xian — about 400 years before Blaise Pascal's 1654 treatise — so in China it is called Yang Hui's (or Jia Xian's) triangle.
奇偶图案是什么?What is the odd/even pattern?
把奇数画成 *、偶数留空,杨辉三角会呈现谢尔宾斯基三角形这种分形:行数取 2 的幂(如 16、32、64)时图案最完整。Drawing odd entries as * and leaving even ones blank turns the triangle into the Sierpiński fractal; it looks most complete when the number of rows is a power of 2 (16, 32, 64).
大数会不会算错?Are the big numbers exact?
会精确到每一位。每个数都用 JavaScript 大整数(BigInt)按 C(r, k) = C(r, k−1) × (r − k + 1) / k 逐个计算,例如第 200 行中间的 C(200, 100) 有 59 位,结果和 Python 的 math.comb 一致。Yes, to the last digit. Each entry is computed with JavaScript big integers (BigInt) using C(r, k) = C(r, k−1) × (r − k + 1) / k; the middle of row 200, C(200, 100), has 59 digits and matches Python's math.comb.
「杨辉三角(帕斯卡三角形)生成器」免费吗?需要注册吗?Is the Pascal's Triangle Generator free? Do I need an account?
「杨辉三角(帕斯卡三角形)生成器」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Pascal's Triangle Generator is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.