bigprimes -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Finding 300 Digit Primes > ## ## rand() returns a random 12 digit integer ## v() returns a random 300 digit integer ## findprime() tries to find a 300 digit prime ## v:=proc() local x,j,z: x:=0: for j from 0 to 24 do z:=rand(): x:=x+z*10^(12*j): od: RETURN(x): end: findprime:=proc() local c,found,b: c:=0: found:=0: b:=v(): while found=0 do if isprime(b) then found:=1: RETURN(b): else c:=c+1: print(c); b:=v(): fi: od: end: > n:=v(); n 373282317168049657140891839025845299334488972809678889514259486897241121380\ := 815880602158984795402283929135411522647038631884911717092157781650667471523608\
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 259875847593084226429749873768285488938286414917752182334245029630812197555292\ 871569833007828194010447912516793709961848657054478696225678109392303 > evalf(log(n)/log(10)); 299.5720374 This n is a random 300 digit integer. On the next line press enter to find a 300 digit prime. How many trials did it take? > p:=findprime(); > > > > EXERCISE (5 points) Edit the function v (above) to return an random 600 digit integer. Reenter the findprime function to find a random 600 digit prime (assuming that MAPLE's isprim e function works). How many trials did it take? > p:=findprime();...
View Full Document

This note was uploaded on 06/04/2011 for the course MAS 4202 taught by Professor Boyland during the Spring '10 term at University of Florida.

Page1 / 2

bigprimes -...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online