function call (marginally) faster than algebraic expression

"Ruud H.G. van Tol" <[email protected]> Sat, 3 Jan 2026 14:24:50 +0100
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
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);