section_0601

# section_0601 - Math 187 Prof Garsia prepared by Alex Brik...

This preview shows pages 1–3. Sign up to view the full content.

Math 187 Prof. Garsia prepared by Alex Brik 06-01-2010 Notes for 06-01 section The following MATLAB programs were used: function L=legendre(a,p) if (mod(a,p)==0) L=0; else L=mod(sym(a)^sym((p-1)/2), p); end; if (mod(L+1,p)==0) L=-1; end; function J=jacobi (a,n) if (a==1) J=1; elseif mod(a,2)==0 J=jacobi(a/2,n)*(-1)^((n^2-1)/8); else J=jacobi (mod(n,a),a)*(-1)^((n-1)*(a-1)/4); end; function b=berlekamp(A,B) r(1)=A; r(2)=B; n=2; p(1)=0; p(2)=1; q(1)=1; q(2)=0; a(1)=0; a(2)=0; n tr n tp n tq n ta n n&); while (r(n)~=0) n=n+1; a(n)=±oor(r(n-2)/r(n-1)); r(n)=r(n-2)-r(n-1)*a(n); p(n)=a(n)*p(n-1)+p(n-2); q(n)=a(n)*q(n-1)+q(n-2); n n&, n-3, r(n), p(n), q(n), a(n)); end; b=[r(n-1) p(n-1) q(n-1) a(n-1)]; Sample problems from 05-26 lecture. 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1. Give the complete list of quadratic residues modulo 37. Solution: for i=1:36 if legendre(i,37)==1 fprintf(&%d &,i);end; end; 1 3 4 7 9 10 11 12 16 21 25 26 27 28 30 33 34 36 2. Find all solutions of the quadratic equation
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

section_0601 - Math 187 Prof Garsia prepared by Alex Brik...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online