mersenneforum.org  

Go Back   mersenneforum.org > Prime Search Projects > Twin Prime Search

Reply
 
Thread Tools
Old 2011-06-03, 06:39   #1
JohnFullspeed
 
May 2011
France

7·23 Posts
Default Twin: new sieve

I devellop a bnew sieve for the twins ,
Sophie Germain... primes
It SEEMS that it's many more faster that actuals but I have to try i really
I use that the first number of twin (and Sophie Germain) can be write like 6k-1
That means that tjhe first number+1
is a power of 6 So my stieve only test 6x -1

Sample:
A:=5;
for i:= 1 to 100000 do
begin
A:=A+6;// next power
if Is_Prime(A) then
If Is_Prime(a+2) then
begin
Inc(trouve);
Twin[trouve]:=A;
end;
You can try this vversion; it's not haard to translate i in C,ASM,Java...
Use your usual Is_Prime.

No RAM, no HD
So can you please tell me is the method is not ??????
I have no one to answer to this question
and before begining a new primegrid project I ask to users ( I seems that we have scientists...)
not if my sieve is good but if it s 'correct'

John

Last fiddled with by JohnFullspeed on 2011-06-03 at 06:44
JohnFullspeed is offline   Reply With Quote
Old 2011-06-03, 11:59   #2
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

102538 Posts
Default

Your pseudocode is incomprehensible, and your English nearly as bad. Can you write in your native language, and post code (in any language you're comfortable with) that at least compiles, please?
Mini-Geek is offline   Reply With Quote
Old 2011-06-03, 15:20   #3
JohnFullspeed
 
May 2011
France

7·23 Posts
Default

Désolé
pour mon anglais mais le code est en Pascal (Delphi)
pas en pseudo code: vous preferez le code en hexa: je laisse le C aux amateurs

J'ai ecrit un crible pour rechercher les nombres premiers jumeau
en me basant sur la proprieté suivane: le premier nombre d'u e paire(jumeaux,sophie Germai..)) peut s'ecrire
6k-1 donc une puissance de 6 -1.

Donc je prends chaque multiple de 6 -1 je regarde si il est premier e si oui je lui ajoute 2 et regarde si le resultat est premier
J'ai donne le code en Pascal le voici en psdeudo code

A <- 5
Faire
A <- A+6
Test A premier?
si oui
A <= A+2
Test A premier
si oui alors TWIN


tant que A<1000T

N'ayant aucune connaissance mathématique j'aimerai savoir si
ce code ne viole pas de concepts mathématiques
Informatique-ment il est bon mais Mathématiquement ?

J'ai calcule tous les jumeaux de moins de 32 Bits <4 200 000 000
en quelque secondes.
Merci de vos aavis
John




You can answer in English I have a translator(one son)

Last fiddled with by JohnFullspeed on 2011-06-03 at 15:23
JohnFullspeed is offline   Reply With Quote
Old 2011-06-03, 17:45   #4
Puzzle-Peter
 
Puzzle-Peter's Avatar
 
Jun 2009

3·223 Posts
Default

John,

it would probably be best to try Prime Grid's forum and talk to geoff and Ken_g6. Just go to end of this thread and you'll find the guys who wrote the twin and Sophie sieve we are using now.

http://www.primegrid.com/forum_thread.php?id=1331

Regards
Peter

PS: looking at the pseudocode, it's not really a sieve. You're testing all numbers of the form A=6n-1 with n=1,2,3,4... and in case of a prime you test A+2 also, is this correct? If yes, it will be very inefficient when the numbers get bigger.

Last fiddled with by Puzzle-Peter on 2011-06-03 at 17:50
Puzzle-Peter is offline   Reply With Quote
Old 2011-06-03, 18:58   #5
JohnFullspeed
 
May 2011
France

7×23 Posts
Smile

Thanks for your answer

En fait la version donnée est la méthode générale mais
l’implémentation est autre: j'ai ajouté de fait des tests
et sélection sur les puissances de 6
Par exemple,mais ne le répéter pas, toutes les puissance de 6 -1 se terminant par 5 ne peuvent être premières
6*6=36 -1=35 on ne teste pas

Par exemple si on prends les 100 premiers nombres
je ne teste que 12 valeurs pour trouver
les jumeaux alors que vous avez 25 primes

Mais je vais chez Prime-Grid

John
JohnFullspeed is offline   Reply With Quote
Old 2011-06-03, 19:21   #6
Puzzle-Peter
 
Puzzle-Peter's Avatar
 
Jun 2009

3×223 Posts
Default

Wow, it's been awhile since I talked French the last time. I hope I understood everything. And I will not try to answer in French, it would be funny without being helpful. Not to say my English is perfect, I'm German...

I think I see the misunderstanding now. We do not test every prime number for a twin. That's what a sieve is for. after creating a list of candidates, e.g. from 1 to 1e12, sieving eliminates a lot of the numbers which are not prime and also numbers which might be prime but cannot have a twin. This is highly effective. I did a twin prime search from scratch for a top-20 twin base 7. If memory serves, the sieving eliminated all but 1 in 500 candidates, roughly estimated.

Thinking about it, eliminating all numbers which are not 6n-1 is the very first two steps in the sieving process (i.e. eliminating multiples of 2 and 3). After that, as you said, it eliminates multiples of 5, 7, 11, 13, 17,.... It seems you're on the right track (even though it's not a new one), the next step would be a more efficient implementation that the current one.

Regards,
Peter
Puzzle-Peter is offline   Reply With Quote
Old 2011-06-04, 06:07   #7
JohnFullspeed
 
May 2011
France

7·23 Posts
Exclamation Precisions

With LLR the stive select candidats and in a second part
verify the Twins with A+2 and a-2


My méthode don't have a sieve: the candidats are directly tested
The enumeration rem ove multiples of 2 and 3 but also 5 and 7....
The s^pirit in not like a crible to take a set of value and to remove all composite:
I create a prime list , I remove composites during the build and not wanted primes

I donwload TwinGen: I'n going to compare
Je vous donnerai les resultats ami europeen

John
JohnFullspeed is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Twin Primes Computer Science & Computational Number Theory 171 2013-05-14 02:57
Advantage of lattice sieve over line sieve binu Factoring 3 2013-04-13 16:32
Twin Primes Hugh Math 64 2011-01-26 08:45
Twin primes again Chris Card Math 1 2005-05-26 14:18
TWIN MOS RAM ET_ Hardware 6 2004-10-21 09:41

All times are UTC. The time now is 08:48.

Thu Jul 2 08:48:55 UTC 2020 up 99 days, 6:21, 0 users, load averages: 1.31, 1.46, 1.33

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.