20110903, 02:18  #12  
Dec 2010
Monticello
5·359 Posts 
Quote:
I say your code is bad because it is unreadable, and therefore the probability of its being correct is asymptotically zero. I was surprised that LaurV actually bothered to analyze it at all...it reads like a bad example out of "A manual of programming style" by Kernighan and Plaugher. You want code??? Here's a complete example of Zimmer's algorithm in C. You probably won't want to run this with ULONG_MAX being the limit as it may take your computer a year or ten....but I imagine it could run in an hour or two if the limit was 2^321 instead. Please focus on what happens at the iteration where N is 50. At that iteration lies the answer to your original question, "Why did Zimmer use Primes(i) [Primelist] function?". Ignore, for the time being, the cost of initializing the external functions such as Primes(i) and IsPrime(i). Code:
// Search for a (likely nonexistant) counterexample to Goldbach's conjecture: // Every even number can be expressed as the sum of two odd prime numbers. // #define bool char //create boolean type; makes code much more readable #define TRUE 1 #define FALSE 0 #include <limits.h> // for ULONG_MAX, check doc to see it's in fact 2^641 #include <stdio.h> // for printf, fprintf.... extern bool IsPrime(unsigned long P); extern unsigned long Primes(unsigned long Rank); // Note: Primes(1)=2; extern void Initialize_Primes(unsigned long SieveMax); int main(int argc, char *argv[]) { bool counterexample; unsigned long N; // The even number being tested to see if it is a counterexample unsigned long i; Initialize_Primes(ULONG_MAX); for (N=6; N< ULONG_MAX; N+=2) { counterexample = TRUE; for (i=2; Primes(i) <= N/2; i++) { if (IsPrime(NPrimes(i)) { counterexample = FALSE; break; } } if (counterexample) { printf("Counterexample to GC: %lu!\n", N); return (1); } if (N%(1UL<<16) == 0) fprintf(stderr, "."); } printf("No Counterexample Found to GC to %lu.\n", N2); return 0; } 

20110903, 05:38  #13  
May 2011
France
7×23 Posts 
Code
One time more the code IS NOT my cocde;: Ot's a sample
Sorrryu if you don't koow the difference. I explaint to you Zimmer'man use a method with the list? ›hyu?: I givve a samle of a logic to verify Golback to explain thhe generrrral wayy I use without the ;list Is't an argument not a final profiuct But of course you doesn't answer, like LaureV Quote:
I wait code... 

20110903, 06:12  #14 
May 2011
France
161_{10} Posts 
Learn...
Try to understand before to speak...
Let Primes be the prime iist (as usual thhe list have 200 000 000 of values) var Bons: array [0..223192870] of byte; Primes :array [0..210000000] of dWord; procedure Load_Primes; var i,J, size: dword; OutFile: file; begin AssignFile(OutFile, 'NPM.bin'); Reset(OutFile, 1); try Blockread(OutFile, Primes[1], 813120892); finally Nb_Np := (813120892 div 4); CloseFile(OutFile); end; end; Procedure Verif_GoldBack(L:Qword); Var I,J:integer; begin Load_Primes: Repeat M:=Primes[i]; for j:=1 to 300 do Bons[M+Primes[j]]:=1; I:=I+1; until M> 223092870500; end I use this code for (FreePAscal) 0 < N < 1 223 193 544 (( 10^ 9) I need 1' 32 Since I optimize and ti is many more faster If you wannt I also can use a second Core bbut it will be more difficult for you. 
20110903, 09:47  #15 
Dec 2010
Monticello
1795_{10} Posts 
John:
Notice the difference between my *sample* code, which is ready for both humans to read and gcc or other "C" compiler, and yours. Si vous suiviez mes instructions, vous comprendiez pourquoi Zimmerman a utilize le liste de nombres primes. Hopefully, LaurV will be back and let me know if I missed anything when I checked my program. Without indentation, (hint: use the [ CODE ] and [ /CODE ] tags, and leave out the spaces to make them active), your code might be legible to the compiler but is undreadable by human beings. Hit the "advanced" button to preview your post. Other hints on readability: Also, in this font, I find variables I and J to be very easy to confuse.....use X and Y if you need to. A file you are reading from should not be called "outfile"  it's not output at this point. You have at least 4 arbitrary constants shown. What are they? Why aren't they symbols with meaningful names? Did you even notice that one of them looks mistyped?(Hint: ULONG_MAX is a predefined constant in C giving the largest value that will fit in an unsigned long.) How would I or anyone know if your program proves Goldbach's conjecture is false? It has no apparent output. Finally, we aren't discussing how you might create the list of primes Primes[i]. Including it distracts from the main point of the discussion. Last fiddled with by Christenson on 20110903 at 10:10 Reason: Looked at the program; needed the (smiley); pardon my french 
20110903, 19:45  #16 
May 2011
France
10100001_{2} Posts 
Blabla
vous etes exactement comme les autres vous avez peur d'etre ridicule
Je vais vous faire une confidence: vous l'etes encore plus en ne repondant pas Vous etes tous aussi grande geule les uns que les autrres Pas in de vouys ne sait se servvir d'un ordinnateur. Je retourne aux calculateurs : la u moans les mathématiciens sont bons. Mais voous avez peir de qui.? Qu'n pauvre con de Français aille plus vite que Maathématica: Votre attitude bornée n'y change rien.. Je vous rassure vous je repards sans rien avoir appris: il n'y a que la médiocrité a apprendre et la encore desolé il y a mieux que vous Gardez vottre code si exeptionnel et allez vous faire voir Meerci de ne pas repondre :rien ne saurait justifier votre meduiocriyé Fin du Débat 
20110903, 20:54  #17 
Apr 2010
Over the rainbow
2,539 Posts 
*translator hat**Be warned, offensive language*
You are exactly like the other, you are afraid to be ridiculous. Let me tell you : you are even more when you do not reply. You are all as big mouthed as each other. Not one of you can properly use a computer. I'm going back to the calculator(??) :At least, there, mathematician are good. Who are you afraid off? That a french cunt could go faster than mathemathica : Your narrow minded attitude change nothing... Let me reassure you, i'm going back having learned nothing : There is only mediocrity to learn , and, there again, there are better people than you. Keep your so called exceptionnal code, and fuck off. Thanks for not answering : Nothing would justify your medicrity. End of the debate.  Now if you made less typo, it would have been easier to translate. Last fiddled with by firejuggler on 20110903 at 20:54 
20110903, 21:00  #18 
(loop (#_fork))
Feb 2006
Cambridge, England
13×491 Posts 
Mr Fullspeed will not be bothering us for a moderate period.
M. Fullspeed ne nous bruterons plus pendant quelques semaines. 
20110903, 21:47  #19  
"Forget I exist"
Jul 2009
Dumbassville
2^{6}·131 Posts 
Quote:
Last fiddled with by science_man_88 on 20110903 at 21:48 

20110904, 00:42  #20  
"Forget I exist"
Jul 2009
Dumbassville
2^{6}·131 Posts 
Quote:
Code:
for(i=0,10,print("X\n"i);forstep(N=prime(2)+1,20,2,print("\t"N);for(J=1,20,HH=Nprime(J);print("\t\t"J);if(isprime(HH),break()));if(N==20,break()));print()) Last fiddled with by science_man_88 on 20110904 at 01:30 

20110904, 04:28  #21  
Dec 2010
Monticello
5×359 Posts 
Quote:
The code I posted is unexceptional; it is the product of an hour or two's work. It is only a simple bruteforce search, and by no means the last word on exhaustively searching for counterexamples to Goldbach's conjecture quickly. I'm still waiting for Mr Fullspeed to analyze it and find the answer to his original question about why Mr Zimmerman used the list of primes, but by no means "holding my breath". I hope others find it reasonably workmanlike and easily understood, and that I put correctness first. 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Rho code  Happy5214  YAFU  3  20151101 21:54 
Please help me with my code  daxmick  Programming  15  20140214 11:57 
Code Help  Andrew  Programming  12  20130216 20:53 
Code  Primeinator  Software  20  20090611 22:22 
A little help with VBS code  IronBits  No Prime Left Behind  6  20081112 14:23 