COMP 547: Assignment 1 Solutions
COMP 547: Assignment 1 Solutions
COMP 547: Assignment 1 Solutions
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
if not pqsqrt(x, p, q) = ’FAIL’ then<br />
s := pqsqrt(x, p, q);<br />
cx := cx + 1;<br />
printf("%d%s%d%s", x, " is in QR_n (root of x: ",\<br />
s, ")\n\n");<br />
elif not pqsqrt(y*x, p, q) = ’FAIL’ then<br />
s := pqsqrt(y*x, p, q);<br />
cyx := cyx + 1;<br />
printf("%d%s%d%s", x, " is not in QR_n (root of \<br />
yx: ", s, ")\n\n");<br />
elif not pqsqrt(z*x, p, q) = ’FAIL’ then<br />
s := pqsqrt(z*x, p, q);<br />
czx := czx + 1;<br />
printf("%d%s%d%s", x, " is not in QR_n (root of \<br />
zx: ", s, ")\n\n");<br />
elif not pqsqrt(z*y*x, p, q) = ’FAIL’ then<br />
s := pqsqrt(z*y*x, p, q);<br />
czyx := czyx + 1;<br />
printf("%d%s%d%s", x, " is not in QR_n (root of \<br />
zyx: ", s, ")\n\n");<br />
end if;<br />
end do;<br />
return(cx, cyx, czx, czyx);<br />
end proc;<br />
This generated the following output:<br />
<strong>547</strong>1234567890 is not in QR_n (root of zyx: 13705545460247289\<br />
385083062216614968438591792875825598148556471487933775598975\<br />
208946117455903638843760177127586959484871315643403479941704\<br />
843055989868092690941284507754839297216918187353326155897289\<br />
21)<br />
<strong>547</strong>1234567891 is not in QR_n (root of zx: 114614823566925985\<br />
551643515222801620939415339830502482519536289797210146571280\<br />
221966028283198847782656061957650810514691634551130723655740\<br />
190889283119459024340464899241280645213504198822616182807224\<br />
4)<br />
<strong>547</strong>1234567892 is not in QR_n (root of zyx: 26647195806483089\<br />
703118775564941631528157362744464496065099558544537315633433\<br />
059571016323384817120797438855826535022742906605003383848290\<br />
875178308792485186669115380551093195142943362548830949456443\<br />
5)<br />
<strong>547</strong>1234567893 is in QR_n (root of x: 13526909176657070629036\<br />
14