function isPrime = isPrime(number)
if number == 2 %base case
isPrime = 1;
return;
end
divisor = 2;
modulo = intDivision(number, divisor);
while modulo(2) > 0 && divisor <= sqrt(number)
divisor = divisor + 1;
modulo = intDivision(number, divisor);
end
if modulo(2) > 0
isPrime = 1;
return;
end
isPrime = 0;
return;
Friday Night Open Thread: Motivation
4 hours ago
No comments:
Post a Comment