proposal to change the return type/value of mpz_primorial_ui

Marco Bodrato bodrato at mail.dm.unipi.it
Thu Nov 11 22:54:30 CET 2021


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/


More information about the gmp-devel mailing list