Igor Schein on Fri, 25 Mar 2005 23:01:29 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

prime/primes performance


Hi,

? n=41561;
? #
   timer = 1 (on)
? v=primes(n);sum(k=1,length(v),v[k])
time = 20 ms.
9925739634
? sum(k=1,n,prime(k))
time = 1,110 ms.
9925739634

Looks like prime() is a very expensive function.  Any comment?

Thanks

Igor