primorial(negative)

Marco Bodrato bodrato at mail.dm.unipi.it
Fri Nov 13 11:02:42 UTC 2015


Ciao Paul,

Il 2015-11-13 09:12 paul zimmermann ha scritto:
>> Date: Fri, 13 Nov 2015 08:11:56 +0100
>> From: "Marco Bodrato" <bodrato at mail.dm.unipi.it>
>> Il Gio, 12 Novembre 2015 10:10 am, paul zimmermann ha scritto:
>> > mpz_prime_t p;
>> > mpz_prime_init_ui (p, 17); /* initializes p to 17 */
>> > mpz_prime_next (p);     /* p <- next_prime(p) */
>> > mpz_prime_clear (p);

> efficiency: the GMP program below takes 1.5 seconds on my computer
> to loop over all primes up to 10^6:

I see.

> sage: for p in prime_range(10^6):
> ....:     s += 1
> ....: print s, cputime(t)

Where, in the interface you proposed for GMP, do you set the upper-limit 
10^6, that you gave to sage?

We should think carefully before we decide to add a new type, should we 
focus on primes or on sieves? Shall the range always start from zero? 
Shall we really loop on mpz? Maybe we prefer a function that fills an 
array?

Regards,
m

-- 
http://bodrato.it/


More information about the gmp-discuss mailing list