CRT、Primitive roots、Discrete Logarithms

The Chinese Remainder Theorem

Used to speed up modulo computations!!!

 

If working modulo a product of numbers: mod M=m1*m2*m3*....*mk

CRT let us work in each moduli mi separately.

 

To compute A(mod M):

1. First compute all   separately

 

Problem 1

If x≡5 mod 7,  x≡3 mod 11, x≡10 mod 13, x mod 1001?

By CRT Theorem,

a1=5, m1=7, M1=143, Y1=M1^-1 mod m1=143^-1 mod 7=2

a2=3,m2=11,M2=91,Y2=M2^-1 mod m2=91^-1 mod 11=12

a3=10,m3=13,M3=77,Y3=M3^-1 mod m3=77^-1 mod 13=12

x=(Y1M1a1+Y2M2a2+Y3M3a3)=(2*143*5+12*91*3+12*77*10)=1430+3276+9240=13946

143d-7f=1

143=20*7+3

7=2*3 +1 

1= 7-2*3

1=7-2*(143-20*7)

1=7-2*143+2*20*7

1=-2*143+41*7

-1=143*2-7*41

-6=143*12-7*41*6

1=143*12-7*247

thus k=12

 

Problem 2

x≡2 mod 3 ,  x≡3 mod 5, x≡2 mod 7, 求x

Answer:

a1=2 , m1=3

a2=3, m2=5

a3=2, m3=7 

M=3*5*7=105

M1=m2*m3=35

M2=m3*m1=21

M3=m1*m2=15

Y1=M1^-1 mod m1=35^-1 mod 3=2

Y2=M2^-1 mod m2=21^-1 mod 5=1

Y3=M3^-1 mod m3=15^-1 mod 7=1

x=(Y1M1a1+Y2M2a2+Y3M3a3) mod M

=(140+63+30)

=233 mod 105

=23

PS:

Y2=21^-1 mod 5=?

By Euclid Theorem,

21d= 1 mod 5

then 21d=1+5f, f is integer,

21d- 5f=1

21= 4*5 +1 

1= 21- 4*5

thus d=1 , f=4

---------------------------

Y3=15^-1 mod 7=

15d- 7f=1 

15=2*7 +1 

1=15-2*7

thus d=1 , f=2

-------------------------

 

Primitive roots

From Euler's theorem have a^Ø(n) =1 mod n

 

Then what is primitive roots???

Consider a^m =1 mod n, gcd(a,n)=1, must exist for m but may be smaller than Ø(n),

if smallest is m=Ø(n) then a is called a primitive root.

for a prime number 19, primitive roots are 2,3,10,13,14,15

 

Discrete Logarithms

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值