Bill Allombert on Tue, 24 Sep 2024 20:42:18 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Suspicious average timing of isprime() (maybe a bug?!) |
On Mon, Sep 23, 2024 at 09:41:50AM -0700, Ilya Zakharevich wrote: > On Sun, Sep 22, 2024 at 04:03:39PM +0200, Bill Allombert wrote: > > > Every batch shows a gradual growth with variation of about 1%. > > > Numbers such that p-1 is hard to factor should be significantly > > slower than other. > > Sorry Bill, but I have no clue what is your intended message here. Do > you want to say that the density of such numbers jumps abruptly by > more than 2 times at about > 403183920143770000000 > then abruptly jumps BACK at about > 2027230320051460000000 > ?! (I would expect not — but then what?!) What you can do is to rerun your benchmark with isprime(,1) and isprime(,2). with isprime(,1) I get something smoother : 1e19 189.000 45880 2e19 3681.500 44838 4e19 4130.500 44297 8e19 4344.000 43762 1e20 4420.500 43404 2e20 4641.500 42725 4e20 4847.000 42300 8e20 5040.000 41404 1e21 5174.000 41402 2e21 5432.500 40757 4e21 5699.000 40163 8e21 5927.500 39419 1e22 6023.000 39582 2e22 6310.500 38710 4e22 6697.500 38553 8e22 7027.000 37802 1e23 7220.500 37954 2e23 7558.000 37394 4e23 8032.000 36879 8e23 8347.500 36435 With isprime(,2) this is much slower and more bumpy. 1e19 8563.500 45880 2e19 11670.000 44838 4e19 13109.000 44297 8e19 25932.000 43762 1e20 25657.500 43404 2e20 24775.000 42725 4e20 24289.500 42300 8e20 80724.000 41404 1e21 80930.500 41402 2e21 79912.000 40757 4e21 16539.500 40163 8e21 16324.500 39419 1e22 16730.000 39582 2e22 16481.500 38710 4e22 16556.500 38553 8e22 16372.500 37802 1e23 16268.500 37954 2e23 16179.000 37394 4e23 31847.500 36879 8e23 31660.500 36435 Do you get something similar ? isprime should probably default to isprimePL for small numbers. Cheers, Bill.