Ilya Zakharevich on Mon, 23 Sep 2024 18:41:57 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Suspicious average timing of isprime() (maybe a bug?!)


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?!)

> You can try to change the threshold in
> 
> src/basemath/prime.c: 554

Apparently, you understand much more about what is going on than me.

I gave you a 4-lines code to reproduce the behaviour.  Just to be more
convenient, the second solve() run was with arguments
   solve(x=1950e18,2100e18,
(but of course, since we solve a timing problem, one should tune the
constant inside solve() to fit the gap between timings on YOUR
machine).

Well, now you know all I do — and much more!

Thanks,
Ilya