SUNY Geneseo Department of Mathematics
Tuesday, September 8
Math 303
Fall 2015
Prof. Doug Baldwin
isprime( n ) Times (Worst Case)
r = floor( √n ) 1
for i = 2 to r r
if n mod i = 0 r-1 = √n - 1
return false 0
end of for
return true 1
if n mod i = 0
poly( a0..n, x )
p = 0
for i = 0 to n
power = 1
for j = 1 to i
power = power * x
end for j
p = p + ai * power
end for i
return p