Twin Primes Program Help

조회 수: 3 (최근 30일)
Brendon
Brendon 2014년 8월 7일
답변: Image Analyst 2014년 8월 8일
I need help writing a program that finds all the twin primes between 10 and 500 without using a built in function.
  댓글 수: 5
Geoff Hayes
Geoff Hayes 2014년 8월 8일
Brendon - suppose you had a set of all numbers from 10 through to 500. Given the definition of a prime number, which of those numbers in this set can you (easily) eliminate first?
The even numbers or all those that are a multiple of two. What numbers could you try to eliminate next? Etc.
Brendon
Brendon 2014년 8월 8일
Thanks for your help.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2014년 8월 8일
Take a look at http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes. I'm sure someone must have coded this up in MATLAB and probably uploaded it to the File Exchange.

카테고리

Help CenterFile Exchange에서 Audio Plugin Creation and Hosting에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by