Question

21. An isolated prime is a prime number p such that neither p -2 nor p+2 is prime. For example, 47 is an isolated prime since
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Matlab Code

clear;clc;
i = 0;
for a=50:100
if rem(a,2:a/2)~=0
i = i+1;
p(i) = a;   
end
end

for i = 1:length(p)
if ismember((p(i)-2),p) && ismember((p(i)+ 2),p)
p = p(p~=p(i));
end
end

p
  

clear: clc 1 for a-50:100 if rem (a, 2:a/2)0 5 p(i)a 6 end end for i = 1: length (p) 10 if ismember ( (p (i)-2),p) ismember (

Add a comment
Know the answer?
Add Answer to:
21. An isolated prime is a prime number p such that neither p -2 nor p+2 is prime. For example, 47 is an isolated prime since 45 and 49 are both not primes. Write a computer program that finds al...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT