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 Center および File ExchangeAudio 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