| Bill Allombert on Thu, 12 Dec 2024 19:24:44 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Is this the way to use auxiliary variables in vector initialized via multiple iterators? |
On Wed, Dec 11, 2024 at 10:16:27PM +0100, hermann@stamm-wilbrandt.de wrote: > 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? No, but frankly I think this is fine like this. Cheers, Bill.