欧拉定理
鸣谢synapse7大大
威尔逊定理
( p − 1 ) ! ≡ p − 1 ≡ − 1       ( m o d   p )   ( p   i s   a   p r i m e ) " role="presentation" style="position: relative;">
由于
简单的证明
费马小定理
假如
p " role="presentation" style="position: relative;"> 是质数,且g c d ( a , p ) = 1 " role="presentation" style="position: relative;"> ,那么a ( p − 1 ) ≡ 1 " role="presentation" style="position: relative;"> (mod p)
简单的证明
欧拉定理
直到今天我才认清这三个人
下面就是ta的故事了:
在计算乘法逆元的时候,我们经常使用的(也是最简单的)就是费马小定理:
假如
p " role="presentation" style="position: relative;"> 是质数,且g c d ( a , p ) = 1 " role="presentation" style="position: relative;"> ,那么a ( p − 1 ) ≡ 1 " role="presentation" style="position: relative;"> (mod p)
实际上费马小定理是欧拉定理的特殊情况+应用
若
n , a " role="presentation" style="position: relative;"> 为正整数,且n , a " role="presentation" style="position: relative;"> 互质,则a ϕ ( n ) ≡ 1 " role="presentation" style="position: relative;"> (mod p)
由此,我们在计算幂的时候(底数与模数互质)则有
简单的证明
然而当底数与模数不互质的时候怎么办呢
我们需要欧拉定理的扩展包:
方便起见,我们可以合并一下:
注意:扩展欧拉定理只影响取模方式,并不影响模数
简单的证明
在
a " role="presentation" style="position: relative;"> 的0 " role="presentation" style="position: relative;"> 次, 1 " role="presentation" style="position: relative;"> 次, . . . , b " role="presentation" style="position: relative;"> 次幂模m " role="presentation" style="position: relative;"> 的序列中,前r " role="presentation" style="position: relative;"> 个数( a 0 到 a r − 1 ) " role="presentation" style="position: relative;"> 互不相同,从第r " role="presentation" style="position: relative;"> 个数开始,每s " role="presentation" style="position: relative;"> 个数就循环一次证明:由鸽巢定理易证
我们把
r " role="presentation" style="position: relative;"> 称为a " role="presentation" style="position: relative;"> 幂次模m " role="presentation" style="position: relative;"> 的循环起始点,s " role="presentation" style="position: relative;"> 称为循环长度。(注意:r " role="presentation" style="position: relative;"> 可以为0)用公式表述为:
a r ≡ a r + s       ( m o d   m ) " role="presentation" style="position: relative;">a " role="presentation" style="position: relative;"> 为素数的情况令
m = ( p r ) " role="presentation" style="position: relative;"> ,则m ′ g c d ( p , m ′ ) = 1 " role="presentation" style="position: relative;"> ,所以p φ ( m ′ ) ≡ 1 ( m o d   m ′ ) " role="presentation" style="position: relative;">又由于
g c d ( p r , m ′ ) = 1 " role="presentation" style="position: relative;"> ,所以φ ( m ′ ) | φ ( m ) " role="presentation" style="position: relative;"> ,所以p φ ( m ) ≡ 1 ( m o d   m ′ ) " role="presentation" style="position: relative;"> ,即
p φ ( m ) = k m ′ + 1 " role="presentation" style="position: relative;"> ,两边同时乘以 " role="presentation" style="position: relative;"> ,得p r p r + φ ( m ) = k m + p r ( 因 为 m = ( p r ) m ′ ) " role="presentation" style="position: relative;">所以
p r ≡ p r + s ( m o d   m ) " role="presentation" style="position: relative;"> ,这里s = φ ( m ) " role="presentation" style="position: relative;">推论:
p b ≡ p r + ( b − r )   %   φ ( m ) ( m o d   m ) " role="presentation" style="position: relative;">又由于
m = ( p r ) " role="presentation" style="position: relative;"> ,所以m ′ φ ( m ) ≥ φ ( p r ) = p r − 1 ( p − 1 ) ≥ r " role="presentation" style="position: relative;">所以
p r ≡ p r + φ ( m ) ≡ p r   %   φ ( m ) + φ ( m ) ( m o d   m ) " role="presentation" style="position: relative;">所以
p b ≡ p r + ( b − r )   %   φ ( m ) ≡ p r   %   φ ( m ) + φ ( m ) + ( b − r )   %   φ ( m ) ≡ p φ ( m ) + b   %   φ ( m ) ( m o d   m ) " role="presentation" style="position: relative;">即
p b ≡ p b   %   φ ( m ) + φ ( m ) ( m o d   m ) " role="presentation" style="position: relative;">
a " role="presentation" style="position: relative;"> 为素数的幂的情况是否依然有
a r ′ ≡ a r ′ + s ′ ( m o d   m ) " role="presentation" style="position: relative;"> (其中s ′ = φ ( m ) , a = " role="presentation" style="position: relative;"> )p k 答案是肯定的,由2知
p s ≡ 1 ( m o d   m ′ ) " role="presentation" style="position: relative;"> ,所以p ( s ∗ ( k / g c d ( s , k ) ) ≡ 1 ( m o d   m ′ ) " role="presentation" style="position: relative;"> ,所以当s ′ = s / g c d ( s , k ) " role="presentation" style="position: relative;"> 时才能有p s ′ k ≡ 1 ( m o d   m ′ ) " role="presentation" style="position: relative;"> ,此时s ′ | s | φ ( m ) " role="presentation" style="position: relative;"> ,且r ′ = c e i l ( r / k ) <= r <= φ ( m ) " role="presentation" style="position: relative;">由
r ′ , " role="presentation" style="position: relative;"> 与s ′ φ ( m ) " role="presentation" style="position: relative;"> 的关系,依然可以得到a b ≡ a b   %   φ ( m ) + φ ( m )   ( m o d   m ) " role="presentation" style="position: relative;">a " role="presentation" style="position: relative;"> 为合数的情况只证
a " role="presentation" style="position: relative;"> 拆成两个素数的幂的情况,大于两个的用数学归纳法可证设
a = a 1 a 2 , a i = p i k i , " role="presentation" style="position: relative;"> 的循环长度为a i " role="presentation" style="position: relative;">s i 则
s | l c m ( s 1 , s 2 ) " role="presentation" style="position: relative;"> ,由于s 1 | φ ( m ) , s 2 | φ ( m ) " role="presentation" style="position: relative;"> ,那么l c m ( s 1 , s 2 ) | φ ( m ) " role="presentation" style="position: relative;"> ,所以s | φ ( m ) " role="presentation" style="position: relative;">r = m a x { c e i l ( r i / k i ) } <= m a x { r i } <= φ ( m ) " role="presentation" style="position: relative;">由
r , s " role="presentation" style="position: relative;"> 与φ ( m ) " role="presentation" style="position: relative;"> 的关系,依然可以得到a b ≡ a b   %   φ ( m ) + φ ( m )   ( m o d   m ) " role="presentation" style="position: relative;">
证毕
相关阅读
闭区间列{[an,bn]}\{[a_n,b_n]\}{[an,bn]}有性质: [an+1,bn+1]⊂[an,bn][a_{n+1},b_{n+1}]\subset[a_n,b_n][an+1,bn+1
定义 先引wiki上的定义 欧拉角:由三个角度组成,在特定坐标系下用于描述刚体的orientation.简单来说,就是绕一个三维坐标系统下的三个
香农三大定理是信息论的基础理论。香农三大定理是存在性定理,虽然并没有提供具体的编码实现方法,但为通信信息的研究指明了方向。香
素数分布:素数定理研究素数素数的个数问题,π(x)\pi(x)π(x)表示不超过xxx的素数的个数。 从 到 素数个数 从 到 素数个数
在开始之前我们先介绍3个定理: 1.乘法逆元 如果ax≡1 (mod p),且gcd(a,p)=1(a与p互质),则称a关于模p的乘法逆元为x。 2.费马小定理: 3