Re: [sage-devel] Speed question re the sigma function

2016-11-15 Thread Vincent Delecroix
On 15 November 2016 at 21:44, Jori Mäntysalo wrote: > On Tue, 15 Nov 2016, John H Palmieri wrote: > >> Also, should we switch to a naive implementation of sigma: essentially >> just >> return sum(divisors(n))? > > > The answer to questions like this is always the same, I guess: > > Add string-valu

Re: [sage-devel] Speed question re the sigma function

2016-11-15 Thread Jori Mäntysalo
On Tue, 15 Nov 2016, John H Palmieri wrote: Also, should we switch to a naive implementation of sigma: essentially just return sum(divisors(n))? The answer to questions like this is always the same, I guess: Add string-valued parameter 'algorithm' with None as default. For None use some kind

Re: [sage-devel] Speed question re the sigma function

2016-11-15 Thread Vincent Delecroix
I guess that it would be much better to also propose access to 1) the flint function void fmpz_divisor_sigma ( fmpz_t res , const fmpz_t n , ulong k ) 2) the pari function sigma For example, pari timing is competitive in this range $ sage -c "timeit('L = [sigma(n) for n in range(10**13, 10

Re: [sage-devel] Speed question re the sigma function

2016-11-15 Thread William Stein
On Tue, Nov 15, 2016 at 11:47 AM, John H Palmieri wrote: > Inspired by the ask.sagemath question > https://ask.sagemath.org/question/35587/why-sigman-seems-not-so-performant-for-small-n/, > I started looking at timings for the sigma function (sigma(n) = sum of the > divisors of n, sigma(n, k) = su

[sage-devel] Speed question re the sigma function

2016-11-15 Thread John H Palmieri
Inspired by the ask.sagemath question https://ask.sagemath.org/question/35587/why-sigman-seems-not-so-performant-for-small-n/, I started looking at timings for the sigma function (sigma(n) = sum of the divisors of n, sigma(n, k) = sum of the kth powers of the divisors of n). On my computer, a