L07 – Prime number theorem, Fermat test, linear congruence equations, and system of linear congruences

Discrete Mathematics2026年3月25日发布 芮和
16.9K 970
8,942字
38–57 分钟

Summary of Lecture 6

L06 – EA, EEA, and Chebyshev’s Theorem

𝐄𝐄𝐀(a,b)\mathbf{EEA}(a, b): inputa,b(ab>0)a, b\,(a \ge b > 0); outputd=gcd(a,b)d = \gcd(a, b), integers s,ts, t such that d=as+btd = as + bt

  • r0=a;r1=b;(s0t0)=(10);(s1t1)=(01);r_0 = a; r_1 = b; \begin{pmatrix} s_0 \\ t_0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix}; \begin{pmatrix} s_1 \\ t_1 \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \end{pmatrix};
  • r0=r1q1+r2(0<r2<r1);(s2t2)=(s0t0)q1(s1t1)r_0 = r_1q_1 + r_2\,(0 < r_2 < r_1); \begin{pmatrix} s_2 \\ t_2 \end{pmatrix} = \begin{pmatrix} s_0 \\ t_0 \end{pmatrix} – q_1 \begin{pmatrix} s_1 \\ t_1 \end{pmatrix}
  • \vdots
  • ri1=riqi+ri+1(0<ri+1<ri);(si+1ti+1)=(si1ti1)qi(siti)r_{i-1} = r_iq_i + r_{i+1}\,(0 < r_{i+1} < r_i); \begin{pmatrix} s_{i+1} \\ t_{i+1} \end{pmatrix} = \begin{pmatrix} s_{i-1} \\ t_{i-1} \end{pmatrix} – q_i \begin{pmatrix} s_i \\ t_i \end{pmatrix}
  • \vdots
  • rk2=rk1qk1+rk(0<rk<rk1);(sktk)=(sk2tk2)qk1(sk1tk1)r_{k-2} = r_{k-1}q_{k-1} + r_k\,(0 < r_k < r_{k-1}); \begin{pmatrix} s_k \\ t_k \end{pmatrix} = \begin{pmatrix} s_{k-2} \\ t_{k-2} \end{pmatrix} – q_{k-1} \begin{pmatrix} s_{k-1} \\ t_{k-1} \end{pmatrix}
  • rk1=rkqkr_{k-1} = r_kq_k
  • output rk,sk,tkr_k, s_k, t_k

O((a)(b))O(\ell(a)\ell(b)) bit operations

Notations:Ω,Θ,π(x)=px1,vp(n)\Omega, \Theta, \pi(x) = \sum_{p \le x} 1, v_p(n)
// pvp(n)|n,pvp(n)+1np^{v_p(n)} | n, p^{v_p(n)+1} \nmid n

THEOREM (Chebyshev, 1850)π(x)=Θ(xlnx)\pi(x) = \Theta\left(\frac{x}{\ln x}\right).

LEMMA: Suppose that m+m \in \mathbb{Z}^+. Then

(2mm)22m2m and (2m+1m)22m\binom{2m}{m} \ge \frac{2^{2m}}{2m} \text{ and } \binom{2m+1}{m} \le 2^{2m}

LEMMA: Suppose that pp is a prime and n+n \in \mathbb{Z}^+. Then

vp(n!)=k1n/pkv_p(n!) = \sum_{k \ge 1} \lfloor n/p^k \rfloor

THEOREM: Let n+n \in \mathbb{Z}^+ and n2n \ge 2. Then π(n)ln22nlnn\pi(n) \ge \frac{\ln 2}{2} \cdot \frac{n}{\ln n}.

COROLLARY:π(x)=Ω(xlnx)\pi(x) = \Omega\left(\frac{x}{\ln x}\right).
// π(x)ln24xlnx\pi(x) \ge \frac{\ln 2}{4} \cdot \frac{x}{\ln x}


Chebyshev’s Theorem

COROLLARY:π(x)=Ω(xlnx)\pi(x) = \Omega\left(\frac{x}{\ln x}\right).

  • For any real number x2x \ge 2, we have π(x)π(x)ln22xlnxln22x1lnxln24xlnx\pi(x) \ge \pi(\lfloor x \rfloor) \ge \frac{\ln 2}{2} \cdot \frac{\lfloor x \rfloor}{\ln \lfloor x \rfloor} \ge \frac{\ln 2}{2} \cdot \frac{x-1}{\ln x} \ge \frac{\ln 2}{4} \cdot \frac{x}{\ln x}

Chebyshev’s theta function:θ(x)=pxlnp\theta(x) = \sum_{p \le x} \ln p
// θ(5.2)=ln2+ln3+ln5=ln30\theta(5.2) = \ln 2 + \ln 3 + \ln 5 = \ln 30

THEOREM:θ(x)=Θ(π(x)lnx)\theta(x) = \Theta(\pi(x) \ln x).

  • θ(x)π(x)lnx\theta(x) \le \pi(x) \cdot \ln x
    // there are π(x)\pi(x) terms in θ(x)\theta(x), each of which is lnx\le \ln x
  • θ(x)x<pxlnp\theta(x) \ge \sum_{\sqrt{x} < p \le x} \ln p
    (π(x)x)lnx\ge (\pi(x) – \sqrt{x}) \ln \sqrt{x}
    // there are at least π(x)x\pi(x) – \sqrt{x} terms in the sum x<pxlnp\sum_{\sqrt{x} < p \le x} \ln p, each lnx\ge \ln \sqrt{x}
    =12(1xπ(x))π(x)lnx= \frac{1}{2} \left( 1 – \frac{\sqrt{x}}{\pi(x)} \right) \pi(x) \ln x
    • π(x)ln24xlnxxπ(x)4lnxxln20\pi(x) \ge \frac{\ln 2}{4} \cdot \frac{x}{\ln x} \Rightarrow \frac{\sqrt{x}}{\pi(x)} \le \frac{4 \ln x}{\sqrt{x} \ln 2} \to 0 (when xx \to \infty)
    • xπ(x)<12\frac{\sqrt{x}}{\pi(x)} < \frac{1}{2} when xx is big enough, say xx0x \ge x_0
    • θ(x)14π(x)lnx\theta(x) \ge \frac{1}{4} \pi(x) \ln x for xx0x \ge x_0

THEOREM: For any integer n1,θ(n)<(2ln2)nn \ge 1, \theta(n) < (2 \ln 2)n.

  • n=1:θ(1)=0<(2ln2)1n = 1: \theta(1) = 0 < (2 \ln 2) \cdot 1
  • n=2:θ(2)=ln2<(2ln2)2n = 2: \theta(2) = \ln 2 < (2 \ln 2) \cdot 2
  • n=3:θ(3)=ln2+ln3<(2ln2)3n = 3: \theta(3) = \ln 2 + \ln 3 < (2 \ln 2) \cdot 3 // ln6<ln26\ln 6 < \ln 2^6
  • n>3n > 3 and 2|n2|n: θ(n)=θ(n1)<(2ln2)(n1)<(2ln2)n\theta(n) = \theta(n-1) < (2 \ln 2)(n-1) < (2 \ln 2)n
  • n>3n > 3 and 2n2 \nmid n: there is an integer m2m \ge 2 such that n=2m+1n = 2m + 1
    • M=(2m+1m)=(2m+1)(m+2)m!<22mM = \binom{2m+1}{m} = \frac{(2m+1)\cdots(m+2)}{m!} < 2^{2m}
    • Any prime p,m+1<p2m+1p, m+1 < p \le 2m+1 must divide MM
    • θ(2m+1)θ(m+1)=m+1<p2m+1lnp\theta(2m+1) – \theta(m+1) = \sum_{m+1 < p \le 2m+1} \ln p
      lnM\le \ln M
      <(2ln2)m< (2 \ln 2)m
    • θ(n)=θ(2m+1)θ(m+1)+θ(m+1)\theta(n) = \theta(2m+1) – \theta(m+1) + \theta(m+1)
      <(2ln2)m+(2ln2)(m+1)< (2 \ln 2)m + (2 \ln 2)(m+1)
      =(2ln2)n= (2 \ln 2)n

THEOREM: For any real number x1,θ(x)<(2ln2)xx \ge 1, \theta(x) < (2 \ln 2)x.
θ(x)=θ(x)<(2ln2)x<(2ln2)x\theta(x) = \theta(\lfloor x \rfloor) < (2 \ln 2)\lfloor x \rfloor < (2 \ln 2)x


Prime Number Theorem

DEFINITION: For x+x \in \mathbb{R}^+, π(x)=px1\pi(x) = \sum_{p \le x} 1: #\# of primes x\le x

THEOREM (Hadamard;Poussin,1896)limxπ(x)xlnx=1\lim_{x \to \infty} \frac{\pi(x)}{\frac{x}{\ln x}} = 1

  • Conjectured by Legendre and Gauss (1777-1855) in 1791, proved independently by Hadamard (1865-1963) and de la Vallée Poussin (1866-1962) in 1896
  • Chebyshev: if the limit exists, then it is equal to 11
  • Rosser (1907-1989) and Schoenfeld (1920-2002) proved in 1962:
    • π(x)>xlnx(1+12lnx)\pi(x) > \frac{x}{\ln x} (1 + \frac{1}{2 \ln x}) when x59x \ge 59
    • π(x)<xlnx(1+32lnx)\pi(x) < \frac{x}{\ln x} (1 + \frac{3}{2 \ln x}) when x>1x > 1

NOTATION:\mathbb{P} – the set of all primes; n={p:2n1p<2n}\mathbb{P}_n = \{p \in \mathbb{P} : 2^{n-1} \le p < 2^n\}.

THEOREM:|n|2nnln2(12+O(1n))|\mathbb{P}_n| \ge \frac{2^n}{n \ln 2} \left(\frac{1}{2} + O\left(\frac{1}{n}\right)\right) when nn \to \infty.

EXAMPLE: The number of nn-bit primes for n{10,,25}n \in \{10, …, 25\}.

nn|n||\mathbb{P}_n|2n1nln2\frac{2^{n-1}}{n} \ln 2nn|n||\mathbb{P}_n|2n1nln2\frac{2^{n-1}}{n} \ln 2
107573.8181074910505.4
11137134.3192039019904.9
12255246.2203863537819.4
13464454.6217358672036.9
14872844.222140336137525.0
1516121575.823268216263091.4
1630302954.624513708504258.5
1757095561.725985818968176.3

Prime Number Generation

Basic Idea: randomly choose nn-bit integers until a prime found.

  • The number of nn-bit integers is 2n12^{n-1}
  • |n|2nnln2(12+O(1n))|\mathbb{P}_n| \ge \frac{2^n}{n \ln 2} \left(\frac{1}{2} + O\left(\frac{1}{n}\right)\right) when nn \to \infty
  • The probability that a prime is chosen in every trial is equal to
    αn=1nln2(1+O(1n)),n\alpha_n = \frac{1}{n \ln 2} \left(1 + O\left(\frac{1}{n}\right)\right), n \to \infty
  • In αn1=nln21+O(1n)2nln2\alpha_n^{-1} = \frac{n \ln 2}{1 + O\left(\frac{1}{n}\right)} \le 2n \ln 2 trials, we get a prime.

Efficient Algorithms: An algorithm is considered as efficient if its (expected) running time is a polynomial in the bit length of its input.
//a.k.a. (expected) polynomial-time algorithm

Expected complexity: Choosing an nn-bit prime can be done efficiently.

  • The expected #\# of trials is 2nln2\le 2n \ln 2, a polynomial in nn (input length)
  • Determine if an nn-bit integer is prime can be done efficiently

THEOREM: An integer n1n \ge 1 is a prime iff an11(modn)a^{n-1} \equiv 1 \pmod{n} for a=1,2,,n1a = 1, 2, \dots, n-1.

  • \implies: by Fermat’s little theorem
  • \implies: if not, then n=kln = kl. We cannot have kn11(modn)k^{n-1} \equiv 1 \pmod{n}

Fermat test: 𝐅𝐞𝐫𝐦𝐚𝐭(n,t)\mathbf{Fermat}(n, t)

  • Input: an odd integer n3n \ge 3 and an integer t1t \ge 1
  • Output: prime/composite
    • for i=1i = 1 to tt do
      • choose a random integer a{2,,n2}a \in \{2, \dots, n-2\}
      • If (an1modn)1(a^{n-1}\bmod n) \neq 1
        • return “composite”
    • return “prime”
  • Analysis:
    • If nn is a prime, always output “prime”
    • If nn is a composite, may output “prime” or “composite”
      // may fail with large probability for certain numbers

Other test algorithms: Solovay-Strassen, Miller-Rabin, Agrawal-Kayal-Saxena (2002)


Linear Congruence Equations

DEFINITION: Let a,b,n+a, b \in \mathbb{Z}, n \in \mathbb{Z}^+. A linear congruence equation is a congruence of the form axb(modn)ax \equiv b \pmod n, where xx is unknown.

THEOREM: Let n+,an \in \mathbb{Z}^+, a \in \mathbb{Z} and d=gcd(a,n)d = \gcd(a, n). Then axb(modn)ax \equiv b \pmod n has a solution if and only if d|bd\mid b.

  • \implies: suppose that ax0b(modn)ax_0 \equiv b \pmod n for a specific x0x_0 \in \mathbb{Z}
    • z\exists z \in \mathbb{Z} such that ax0b=nzax_0 – b = nz
    • b=ax0nzb = ax_0 – nz
    • d|a,d|nd|bd\mid a, d\mid n \implies d\mid b
  • \impliedby: suppose that d|bd\mid b
    • d=gcd(a,n)d = \gcd(a, n)
      • s,t\exists s, t \in \mathbb{Z} such that as+nt=das + nt = d
      • b=dz=asz+ntzb = dz = asz + ntz
      • a(sz)b(modn)a(sz) \equiv b \pmod n
      • szsz is a solution

THEOREM: Let n+,a,gcd(a,n)=d,t=(ad)1(modnd)n \in \mathbb{Z}^+, a \in \mathbb{Z}, \gcd(a, n) = d, t = \left(\frac{a}{d}\right)^{-1} \pmod{\frac{n}{d}}.
If d|bd\mid b, then axb(modn)ax \equiv b \pmod n iff xbdt(modnd)x \equiv \frac{b}{d}t \pmod{\frac{n}{d}}.

  • d=gcd(a,n),d|bd = \gcd(a, n), d\mid b
  • axb(modn)n|(axb)ax \equiv b \pmod n \iff n \mid (ax – b)
  • n|(axb)nd|(adxbd)n \mid (ax – b) \iff \frac{n}{d}\mid \left(\frac{a}{d}x – \frac{b}{d}\right)
  • nd|(adxbd)adxbd(modnd)\frac{n}{d} \mid \left(\frac{a}{d}x – \frac{b}{d}\right) \iff \frac{a}{d}x \equiv \frac{b}{d} \pmod{\frac{n}{d}}
  • adxbd(modnd)tadxtbd(modnd)\frac{a}{d}x \equiv \frac{b}{d} \pmod{\frac{n}{d}} \implies t\frac{a}{d}x \equiv t\frac{b}{d} \pmod{\frac{n}{d}}
    xtbd(modnd)\implies x \equiv t\frac{b}{d} \pmod{\frac{n}{d}}
  • xtbd(modnd)tadxtbd(modnd)x \equiv t\frac{b}{d} \pmod{\frac{n}{d}} \implies t\frac{a}{d}x \equiv t\frac{b}{d} \pmod{\frac{n}{d}}
    adxbd(modnd)\implies \frac{a}{d}x \equiv \frac{b}{d} \pmod{\frac{n}{d}}
  • t=(ad)1(modnd)t = \left(\frac{a}{d}\right)^{-1} \pmod{\frac{n}{d}}
  • tad1(modnd)t\frac{a}{d} \equiv 1 \pmod{\frac{n}{d}}
  • 1tad(modnd)1 \equiv t\frac{a}{d} \pmod{\frac{n}{d}}
  • xtadx(modnd)x \equiv t\frac{a}{d}x \pmod{\frac{n}{d}}

System of Linear Congruences

Sun-Tsu’s Question: There are certain things whose number is unknown. When divided by 3, the remainder is 2; when divided by 5, the remainder is 3; and when divided by 7, the remainder is 2. What will be the number of things?

  • x2(mod3)x \equiv 2 \pmod{3};
  • x3(mod5)x \equiv 3 \pmod{5};
  • x2(mod7)x \equiv 2 \pmod{7}

DEFINITION: A system of linear congruences is a set of linear congruence equations of the form

{a1xb1(modn1)a2xb2(modn2)akxbk(modnk).\begin{cases}a_1 x \equiv b_1 \pmod{n_1} \\a_2 x \equiv b_2 \pmod{n_2} \\\vdots \\a_k x \equiv b_k \pmod{n_k}\end{cases}.
  • xx \in \mathbb{Z} is a solution if it satisfies all kk equations.
© 版权声明

相关文章

97 条评论

  • 丝绸商
    丝绸商 读者

    CRT那块能不能展开讲讲

    阿根廷
    回复
    • 云端主宰
      云端主宰 读者

      我也在等博主展开讲讲

      中国广东@ 丝绸商
      回复
  • 白术
    白术 读者

    素数密度表看着真慢 😂

    中国广西
    回复
  • Ancient Oak
    Ancient Oak 读者

    公式量蛮大的,得慢慢啃。

    日本
    回复
    • 人群滤镜
      人群滤镜 读者

      同感,我也在慢慢死磕

      蒙古@ Ancient Oak
      回复
  • 独坐星空
    独坐星空 读者

    费马测试在实际用的时候t取多少合适啊

    瑞士
    回复
  • 书吏文渊
    书吏文渊 读者

    费马测试那个伪素数坑有点深

    澳大利亚
    回复
  • Sky苍穹
    Sky苍穹 读者

    EEA那块矩阵写法还挺巧妙的

    新加坡
    回复
    • 蹦蹦床
      蹦蹦床 读者

      这样写看着顺眼多了

      美国@ Sky苍穹
      回复
  • PhantomFable
    PhantomFable 读者

    质数定理这部分推导太绕了

    日本
    回复
  • 潜意识潮汐
    潜意识潮汐 读者

    中国剩余定理那个例子挺经典的,就是计算量有点大。

    中国广东
    回复
    • The Silk Weaver
      The Silk Weaver 游客

      三除数那个例子手算了一遍,结果还挺神奇的

      中国广东@ 潜意识潮汐
      回复
  • 社恐且嚣张
    社恐且嚣张 读者

    这排版简直要命,公式跑到下一行了。

    日本
    回复
  • 天启网络
    天启网络 读者

    最后那个同余方程组看着就头大

    美国
    回复
    • VeiledMidnight
      VeiledMidnight 读者

      我也看得头大,太绕了

      中国重庆@ 天启网络
      回复
  • 冰霜圣歌者
    冰霜圣歌者 读者

    费马测试遇到卡迈克尔数就没戏了

    印度
    回复
    • 小寒松涛
      小寒松涛 读者

      确实,碰到这种数就头大。

      中国江西@ 冰霜圣歌者
      回复
  • 幽灵之吻
    幽灵之吻 游客

    之前手算EEA卡了半小时,后来直接用Python脚本一键求解,省了不少时间。

    马来西亚
    回复
  • 孤星旅行者
    孤星旅行者 游客

    刚看完上一讲,这个Chebyshev定理的证明太硬核了。

    中国浙江
    回复
    • 疯批
      疯批 读者

      这证明步骤看着就头疼,跳步太多了吧

      中国江苏@ 孤星旅行者
      回复
    • The Imperial Astrologer
      The Imperial Astrologer 游客

      Chebyshev那段硬核,我卡了好几遍,关键是那步不等式的转化。

      巴基斯坦@ 孤星旅行者
      回复
  • 雾中瞳
    雾中瞳 游客

    线性同余里模数不互质时解法怎么处理?

    巴基斯坦
    回复
  • 社交隐形术
    社交隐形术 读者

    素数定理的推导过程挺清晰

    美国
    回复
  • 皮皮虾快跑
    皮皮虾快跑 读者

    线性同余方程这块有点绕啊

    美国
    回复
  • 小狗球球
    小狗球球 游客

    这费马小测真的会卡Carmichael数吗?

    中国香港
    回复
  • 欢快溪流
    欢快溪流 读者

    费马测试对Carmichael数不是直接失效吗?这也没提啊。

    中国陕西
    回复
  • 寒冰之心
    寒冰之心 游客

    EEA写法确实比矩阵直观多了。

    中国北京
    回复
  • 虚无捕手
    虚无捕手 游客

    中国剩余定理的数值例子能再给个吗

    中国辽宁
    回复
  • 金凤
    金凤 游客

    看到组合数估计那块直接放弃了

    中国
    回复
  • 幻术师
    幻术师 游客

    同余方程组要是模数不互质咋办

    中国内蒙古
    回复
  • 潮流指挥官
    潮流指挥官 读者

    EEA那个矩阵写法看着真头疼,还是手算靠谱。

    中国湖南
    回复
  • 永恒之怒
    永恒之怒 读者

    模运算这块是不是该先复习下基础

    中国上海
    回复
  • 沉睡之海
    沉睡之海 读者

    线性同余那块讲得有点绕,看了半天才反应过来。

    中国湖南
    回复
    • 火之使徒
      火之使徒 游客

      同余方程的通解公式有人试过推导吗

      韩国@ 沉睡之海
      回复
  • 混沌低语者
    混沌低语者 游客

    theta函数的上界证明构造真巧妙

    中国上海
    回复
  • AbyssHunter
    AbyssHunter 游客

    素数生成这块代码实现起来容易翻车

    韩国
    回复
  • 环保先锋
    环保先锋 读者

    费马测试的伪阳性率到底多高啊

    韩国
    回复
  • 白绫吊死鬼
    白绫吊死鬼 读者

    笔记记得挺全,就是有些跳步,那个O(1/n)怎么来的想了半天。

    中国上海
    回复
  • 潮流引领者
    潮流引领者 读者

    线性同余方程组要是模数不互质,解起来可就麻烦多了,这里好像只讲了互质的情况?

    中国湖北
    回复
  • 时之砂守护者
    时之砂守护者 游客

    之前搞过素数生成,用Miller-Rabin比Fermat稳定多了

    中国湖北
    回复
    • 孤影摇曳
      孤影摇曳 游客

      Miller‑Rabin确实靠谱,之前我用它找大素数也没踩坑

      中国浙江@ 时之砂守护者
      回复
  • 丝路旅人
    丝路旅人 读者

    求问Fermat测试里的t值一般取多少比较稳妥?

    中国福建
    回复
    • 初弦
      初弦 游客

      一般取个40到50次就差不多了,误判概率低到可以忽略。

      中国新疆@ 丝路旅人
      回复
    • 暗夜血伯爵
      暗夜血伯爵 游客

      刚去查了下,原来Fermat测试失败的概率确实有上界,不算太离谱。

      中国陕西@ 丝路旅人
      回复
  • 橡皮糖
    橡皮糖 读者

    费马小定理的逆命题不成立才搞出这么多麻烦事,不然哪用得着Miller-Rabin。

    中国陕西
    回复
    • 梦幻小精灵
      梦幻小精灵 游客

      逆命题不对才让我们去发明更强的检测,没它也不会有Miller‑Rabin的需求

      中国上海@ 橡皮糖
      回复
  • 烽火使
    烽火使 读者

    这个素数密度表有点意思,位数越多比例越小是肯定的,但这收敛速度看着真慢。

    日本
    回复
    • 软糖小星星
      软糖小星星 游客

      确实收敛慢得让人抓狂。

      中国四川@ 烽火使
      回复
    • GlacialWarden
      GlacialWarden 游客

      我试过算大位,真的卡死。

      中国上海@ 烽火使
      回复
    • 星辰行者
      星辰行者 游客

      比例下降快得离谱。

      中国辽宁@ 烽火使
      回复
    • 行旅天涯
      行旅天涯 游客

      这个表格太炫酷了 😎

      日本@ 烽火使
      回复
    • 灯匠韩
      灯匠韩 读者

      确实,位数大概率低,翻倍尝试是常规。

      中国湖南@ 烽火使
      回复
  • 神瑛侍者
    神瑛侍者 读者

    EEA其实就是辗转相除的副产品,把每一步的逆运算记下来就行。

    日本
    回复
  • 云端絮语
    云端絮语 游客

    这排版在手机上看简直灾难,公式都错位了。

    印度
    回复
  • 幽谷深潭
    幽谷深潭 游客

    看到theta函数那堆不等式变换我就想睡觉,直接记结论行不行?

    中国浙江
    回复
  • 神经幻想
    神经幻想 读者

    同问,而且这笔记里好像没提Carmichael数,那个才是Fermat测试的大坑。

    中国上海
    回复
    • 醉月刀仙
      醉月刀仙 游客

      对,Carmichael数正是Fermat测试的致命盲点,实际项目里几乎都改用Miller‑Rabin或AKS才能保证安全。

      中国北京@ 神经幻想
      回复
  • ChillOverlord
    ChillOverlord 游客

    这个Chebyshev上界的证明构造太精妙了,硬生生把组合数和素数分布扯上关系。

    日本
    回复
    • 疯癫客
      疯癫客 读者

      这一步把组合数和素数扯在一起,我有点懵,能再举个例子吗?

      中国上海@ ChillOverlord
      回复
    • 木匠董
      木匠董 游客

      这证明挺秀的,佩服。

      中国湖南@ ChillOverlord
      回复
    • 湖畔垂钓
      湖畔垂钓 读者

      上界的常数选的有点奇怪。

      中国北京@ ChillOverlord
      回复
  • 飞鸟与远行
    飞鸟与远行 读者

    同余方程的条件判断挺关键的

    马来西亚
    回复
  • 毁灭之歌
    毁灭之歌 读者

    质数定理这块公式看得眼花

    中国湖北
    回复
  • 水泥管道
    水泥管道 读者

    同余方程这块我上课也没太听懂。

    中国湖北
    回复
  • 碧海灵瞳
    碧海灵瞳 读者

    费马测试这块还是有点懵

    中国福建
    回复
    • 爱冒险的薯条
      爱冒险的薯条 读者

      同感,我也卡在这里

      日本@ 碧海灵瞳
      回复
  • 碧海歌者
    碧海歌者 读者

    同余方程组这块例子挺生动的。

    澳大利亚
    回复
  • 甜心奶球
    甜心奶球 读者

    线性同余这块可以再展开讲讲吗?

    日本
    回复
  • 水色天光
    水色天光 读者

    同余方程组的解是不是唯一的?

    中国湖北
    回复
  • 烤红薯香喷喷
    烤红薯香喷喷 读者

    素数定理这结论挺直观的

    美国
    回复
  • 檀木余温
    檀木余温 读者

    同余方程组这块例子挺生动的。

    中国广东
    回复
  • 磨坊姚
    磨坊姚 读者

    费马测试部分没太看懂。

    中国黑龙江
    回复
    • 月隐霜华
      月隐霜华 游客

      费马测试那段代码哪里出错了?

      中国天津@ 磨坊姚
      回复
    • 废土炼金师
      废土炼金师 游客

      我看不懂那一步的模运算,能贴个具体算例并解释下为什么会这样吗?

      日本@ 磨坊姚
      回复
    • 琴音袅袅
      琴音袅袅 游客

      其实伪素数Carmichael数会让Fermat误判,我之前踩过坑,建议加Miller‑Rabin做二次验证。

      日本@ 磨坊姚
      回复
  • 长安旅人
    长安旅人 读者

    这课信息量有点炸裂,EEA推导那步卡了我十分钟😂

    中国
    回复
    • 澜星
      澜星 游客

      正常,那个矩阵变换一开始看都懵,多推两遍就顺了。

      日本@ 长安旅人
      回复