-
1 Comment
Gaston Levannier
on 2 Nov 2017
With my function and R2015B, it works so I don't understand:
function y = isPernicious(x)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
if(x == 1)
y = true;
else
if(mod(x,2) == 0)
y = false;
else
y = true; % PRIME
for k=3:2:x-2
if(mod(x,k) == 0)
y = false; % NOT PRIME
break;
end
end
end
end
end
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!