| Ruud H.G. van Tol on Sat, 03 Jan 2026 14:24:54 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| function call (marginally) faster than algebraic expression |
I noticed that lista1(n)= vector(n+1, i, binomial(i, 2)^2); is 20% faster than variants like lista2(n)= vector(n+1, i, ((i^2-i)/2)^2); in my GP/PARI v.2.17.3 (tested with n=10^6). Is that as expected? -- Ruud P.S. And with some storage, much slower: lista3(n)= my(s=0); vector(n+1, i, s+=(i-1)^3);