Thread: New Code View Single Post
 2011-09-01, 19:03 #5 JohnFullspeed   May 2011 France A116 Posts Goldback Code: Procedure Veri_GoldBack(L:Qword); Var I,J,W:integer; M,N,R: Qword; e2: double; Label LN; begin I:=0; HH:=0; // Le nombre - le NP N:=Primes[200]+1; /// for testing Not 0 1223 a1 := GetTickCount; //timer Offset:=0; // sortie repeat LN: N:= N+2; If N>200000 then Break;// stop here j:=1; repeat HH:=N-Primes[j]; // test des divisions if not Is_Div(HH) then Goto LN; J:=J+1; until J> 20; I:=I+1; // not found until i>1000; a1 := GetTickCount-a1; IsPrime: Code: Function Is_Div(A: QWord):boolean; var i,R,S: Cardinal; E5:extended; begin Result:=True; E5:=A; R:= Round(Sqrt(E5)); i:=2; repeat If A mod Primes[i]=0 then exit; I:=I+1; until Primes[i] > r; Result:=False; end; Like you can see ,I verify since N=1223+1 even. The step is 2 (even) and I stop at 200 000 So I do 99 383 verifs And now like Jasonp,axn,Five,silver,Bssquare... you stop to answer because your times are not in the same range that me, and you thinks that I most better that you You stop to answer. I m not better than other but it's my job. With the bad test of division I need 0,8 ... seconds Perhaps I can learn to you if you want The code is not magic The time is on my RISC for a CISC the code will be other PS can you give me the time for for i:=1 to 100000 do a=isprime(i); They all say No.