my error when i wrote that x*x or x^2 is not working
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mohammed AL Rashedi
am 3 Mär. 2023
Kommentiert: Mohammed AL Rashedi
am 3 Mär. 2023
n=1:100;
x=0:1;
for i=1:length(n)
x^2 = mod(x,n(i));
end
i want to get all value of n where x=0 And x = 1 onnnllly
4 Kommentare
Voss
am 3 Mär. 2023
"is true whene n = 7,25,13,...."
What's true when n = 7, 25, 13, ...?
What are you actually trying to do?
Akzeptierte Antwort
Voss
am 3 Mär. 2023
Maybe this:
n=1:100;
n_true = [];
for i=1:length(n)
x = 2:n(i)-1;
x2 = mod(x.^2,n(i));
if ~any(x2 == x)
n_true(end+1) = n(i);
end
end
disp(n_true);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Genomics and Next Generation Sequencing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!