[关闭]
@chawuciren 2019-11-19T10:41:27.000000Z 字数 2091 阅读 475

CINTA作业14-CRT题

CINTA


5.1
a=8,b=3,p=11,q=19,n=pq=209
using EGCD algothm

y=41

5.2
M=5*7*9*11=3465








5.3

  1. /*
  2. * Input: a,b,q,p(x=a (mod q) x=b(mod p))
  3. * Output: x
  4. */
  5. int CRT(int a,int p,int b,int q){//x=a (mod q) x=b(mod p)
  6. int n=p*q;
  7. int p_1=egcd(p,q);
  8. if(p_1<0) p_1=q+p_1; //overflow
  9. int q_1=egcd(q,p);
  10. if(q_1<0) q_1=p+q_1;
  11. int y=(a*q*q_1)%n+(b*p*p_1)%n;
  12. return y; //return solution
  13. }
  14. int egcd(int a, int b){
  15. int r0=1,s1 = 1;
  16. int r1=0,s0=0,q = 0,temp=0;
  17. while (b){
  18. q = a / b; //Seeking quotient
  19. a = a%b;
  20. swap(&a,&b);//Gcd algorithm on the right side of the equation
  21. r0 = r0-(q*r1);//Gcd algorithm on the left side of the equation
  22. swap(&r0,&r1);
  23. s0 = s0 - (q*s1);
  24. swap(&s0,&s1);
  25. }
  26. return r0;
  27. }
  28. void swap(int*a,int *b){//Exchange the values of a and b
  29. int temp=*a;
  30. *a=*b;
  31. *b=temp;
  32. }

5.4
proof:
Define f

1.Show f is injective
Suppose:


So it doesn't exist

2.Show f is surjective


So f is surjective

3.Check that f(x) preserves the group operation.

it is an isomorphism from .

5.5

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注