Ruud H.G. van Tol on Mon, 22 Jan 2024 11:56:34 +0100


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

Re: log_int_rat



On 2024-01-22 11:25, Ruud H.G. van Tol wrote:
[...]
On the non-discrete code branch:

  a(n) = localbitprec(logint(n+2,2)); 1 + n + floor(n*log(2)/log(3/2));

with test:

  {default(parisizemax,2^30); my(v=alist(2^20)); for(n=1,#v, (v[n]!=a(n-1)) && print(n);break);}

I received this report:

> that code wrong result a(83690) = 226760 (in a 32-bit pari)
> with no hint that it didn't know right from wrong.


? my(v=alist(83700)); v[83691]
cpu time = 485 ms, real time = 490 ms.
% 226759

My current guess is that it needs something more like
  localbitprec(2*n+1); ...

-- Ruud