BY USING MATLAB CODE find the smallest prime greater than 30000 I did the way be
ID: 3013145 • Letter: B
Question
BY USING MATLAB CODE find the smallest prime greater than 30000 I did the way below, can you help me to find out what parts of answer I have to change in order the program works d=primes(100000);%my answer disp(min(find(d>30000)))B) find the 130000th prime (2 is the 1st prime)
p=primes(5000000);% find the 2370th prime disp(p(130000))
BY USING MATLAB CODE find the smallest prime greater than 30000 I did the way below, can you help me to find out what parts of answer I have to change in order the program works d=primes(100000);%my answer disp(min(find(d>30000)))
B) find the 130000th prime (2 is the 1st prime)
p=primes(5000000);% find the 2370th prime disp(p(130000))
BY USING MATLAB CODE find the smallest prime greater than 30000 I did the way below, can you help me to find out what parts of answer I have to change in order the program works d=primes(100000);%my answer disp(min(find(d>30000)))
B) find the 130000th prime (2 is the 1st prime)
p=primes(5000000);% find the 2370th prime disp(p(130000))
Explanation / Answer
d=primes(100000);
j = (min(find(d>30000)));
k = d(j) ;
k will give you next prime ,note j is index/position of d>30000,
B) for finding 2370
p = primes(5000000); % note here 5000000 is not mandatory ,any number below which 2370 prime exist will work
r = p(2370)
for dinding (130000) , we can do similarly
p = primes(50000000); % note length of p is 3001134 > 130000,so it will work
disp(p(130000))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.