![]() |
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 |
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?
|
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) |
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. [URL]http://www.primegrid.com/forum_thread.php?id=1331[/URL] 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. |
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 |
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 |
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 |
| All times are UTC. The time now is 13:34. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.