First, thank you for your work. I will be using it. I'd like to see it or similar become part of the GMP library.
I also would like to see the primordial function return that same value because it knows the value. In my work, I use primordial in ways similar to factorials, and I use it over a factorial because it simply grows faster. Your work is appreciated here, Marco. On Thu, Nov 11, 2021 at 1:54 PM Marco Bodrato <bodr...@mail.dm.unipi.it> wrote: > > Ciao, > > Il 2021-11-08 18:57 Marco Bodrato ha scritto: > > I got inspired by a piece of code that Seth Troisi sent a couple of > > years ago and I wrote a gmp_pi_ui(n) function with two variants, a > > trivial one (it calls gmp_primesieve) and an implementation of the > > Legendre strategy. > > > > I attach it for comments. Compiled with -DMAIN it prints the number of > > primes up to increasing powers of two. On my computer, with small > > ranges it is slower than GP/Pari, for large ranges, it is faster... > > I checked the results against https://oeis.org/A007053 and > https://oeis.org/A006880 up to 2^47. Everything seems correct... Of > course, for "large" (>2^32) values it is a slow function. > > It currently takes an ui for the argument. But it should not be > impossible to implement it also for values larger than 32 bits on > 32-bits CPUs... Is it worth trying? > > Ĝis, > m > > -- > http://bodrato.it/papers/ _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel