function speedtrace_isprime();
p = [2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433, ...
1257787, 2976221, 3021377, 6972593, 13466917, 20996011, 24036583, 25964951, 30402457, 32582657, ...
37156667, 42643801, 43112609, 57885161, 74207281, 77232917, 82589933];
speedtrace = fopen('speedtrace_isprime.txt', 'w');
fprintf(speedtrace, "%s %s \n", "Start: ", string(datetime));
fprintf(speedtrace, "%s \n", "getestete Primzahl, Zeit in Sekunden, Uhrzeit/Datum");
fclose(speedtrace);
base = sym("2");
disp(["getestete Primzahl, Zeit in Sekunden, Uhrzeit/Datum"]);
for k = 1:1:numel(p);
tic;
isprime(base^p(k)-1);
Zeit(k) = toc;
fprintf("2^%i-1 %f %s \n", p(k), Zeit(k), datetime);
speedtrace = fopen('speedtrace_isprime.txt', 'a');
fprintf(speedtrace,"2^%i-1 %f %s \n", p(k), Zeit(k), datetime);
fclose(speedtrace);
end;
speedtrace = fopen('speedtrace_isprime.txt', 'a');
fprintf(speedtrace, "%s %s \n", ["Ende: ", string(datetime)]);
fclose(speedtrace);
end
4 Comments
Direct link to this comment
https://it.mathworks.com/matlabcentral/answers/477086-isprime-function-seems-to-have-poor-performance#comment_737753
Direct link to this comment
https://it.mathworks.com/matlabcentral/answers/477086-isprime-function-seems-to-have-poor-performance#comment_737753
Direct link to this comment
https://it.mathworks.com/matlabcentral/answers/477086-isprime-function-seems-to-have-poor-performance#comment_737769
Direct link to this comment
https://it.mathworks.com/matlabcentral/answers/477086-isprime-function-seems-to-have-poor-performance#comment_737769
Direct link to this comment
https://it.mathworks.com/matlabcentral/answers/477086-isprime-function-seems-to-have-poor-performance#comment_737885
Direct link to this comment
https://it.mathworks.com/matlabcentral/answers/477086-isprime-function-seems-to-have-poor-performance#comment_737885
Direct link to this comment
https://it.mathworks.com/matlabcentral/answers/477086-isprime-function-seems-to-have-poor-performance#comment_738058
Direct link to this comment
https://it.mathworks.com/matlabcentral/answers/477086-isprime-function-seems-to-have-poor-performance#comment_738058
Sign in to comment.