When one asks sage: sigma? it gies at the end: " *Craig Citro (2007-06-01): rewrote for huge speedup" Now : sage: %timeit sage: for n in xsrange(1,10000): c=sigma(n) 5 loops, best of 3: 181 ms per loop
but it seems much quicker when you directly sum the divisors
sage: %timeit sage: def s(n): return sum(divisors(n)) sage: for n in xsrange(1,10000): c=s(n) 5 loops, best of 3: 44.8 ms per loop
The same with sigma(n,k). Why that happens?