07.01.2015 Views

COMP 547: Assignment 1 Solutions

COMP 547: Assignment 1 Solutions

COMP 547: Assignment 1 Solutions

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

all functions I wrote for this assignment, I used the randomize function<br />

to set the seed used by functions such as rand to a number that is based<br />

on the system clock. Although my random numbers are still deterministically<br />

computed, they are, in a sense, more random and more difficult to<br />

randomly reproduce.<br />

But there is worst, the random generator Randpoly is not very good and<br />

loops around quite quickly. You could not, in fact generate the entire field.<br />

2. To build the field F 2 1000 using P , one must use Maple’s GF function:<br />

F21000 := GF(2, 1000, P);<br />

This generated the following output:<br />

F21000 := module () export +, -, *, /, ^, input, output,<br />

inverse, extension, variable, factors, norm, trace, order,<br />

random, size, isPrimitiveElement, PrimitiveElement,<br />

ConvertIn, ConvertOut, zero, one, init; end module<br />

3. myFindPrim := proc(Field)<br />

local factors, m, f, g, i;<br />

randomize();<br />

factors := [31, 601, 4710883168879506001, 269089806001,<br />

1801, 3, 11, 251, 229668251, 5519485418336288303251,<br />

4051, 5, 94291866932171243501, 268501, 28001, 96001,<br />

41, 101, 47970133603445383501, 3775501, 7001, 8101, 17,<br />

61681, 401, 3173389601, 2787601, 340801, 8877945148742\<br />

945001146041439025147034098690503591013177336356694416\<br />

517527310181938001, 4001, 1074001, 2020001, 22624001,<br />

1481124532001];<br />

m := [seq((2^1000 - 1)/factors[i], i = 1..34)];<br />

f := 0;<br />

while f = 0 do<br />

f := 1;<br />

g := Field[input](rand(0..2^1000-1)());<br />

for i from 1 to 34 do<br />

if Field[‘^‘](g, m[i]) = Field[one] then<br />

f := 0;<br />

break;<br />

end if<br />

end do;<br />

end do;<br />

return(g);<br />

end proc;<br />

This generated the following primitive element g:<br />

4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!