hermann on Wed, 11 Dec 2024 22:16:32 +0100


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

Is this the way to use auxiliary variables in vector initialized via multiple iterators?


Doc talks about
https://pari.math.u-bordeaux.fr/pub/pari/manuals/2.17.0/users.pdf#page=25

"To iterate over more than one variable, you may separate clauses with ; as in"

I found no mentioning how to introduce auxiliary variables to avoid repetition of terms.

I wanted to use auxiliary variable s for sum p^2+4*q^2, and this does the job:

? P=primes([2,100]);vecmin([s|p<-P;q<-P;s<-[p^2+4*q^2],isprime(s)])
41
?

Is there another way of assignment to s without having to introduce auxiliary single element set?

Regards,

Hermann.