hermann on Thu, 15 Jan 2026 00:49:12 +0100


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

Questions on alternative set notations


Alternative set notations are documented here:
https://pari.math.u-bordeaux.fr/pub/pari/manuals/2.17.2/users.pdf#page=25

As an example I am interested in Euler polynomial values

? [k^2+k+41|k<-[0..11]]
[41, 43, 47, 53, 61, 71, 83, 97, 113, 131, 151, 173]
?

that belong to Mod(1,4).


Which of the following is preferable?
(1+2 filter, so 50% of the values; 3 results in 100% of initial set values)

? [k^2+k+41|k<-[0..11],(k%4)%3==0]
[41, 53, 61, 97, 113, 173]
?
? [k|l<-[0..11];k<-[l^2+l+41],k%4==1]
[41, 53, 61, 97, 113, 173]
?
? [k^2+k+41|l<-[0..11];k<-[(l\2)*4+3*(l%2)]]
[41, 53, 61, 97, 113, 173, 197, 281, 313, 421, 461, 593]
?


Is there a more natural alternative to sequence assignment workaround "...;k<-[f(l)]..." that works in alternative sets?


Regards,

Hermann.