Description:
takes a vector "x", and generates all the possible sums among pairs of different elements (binary combinations) divided by "y" (having assumed that such sums are 0 Mod "y"), excluding those sums where the position of at least one of the operands is listed in "z".
GP Source code:
vecbinariesums(x,y=2,z=[1])={my(p,t,v=vector(binomial(#x-#z,2)));if(y,forvec(u=vector(2,j,[1,#x]),p=1;if(#z,p*=prod(l=1,#z,(u[1]!=z[l])&&(u[2]!=z[l])));if(p,v[t++]=(x[u[1]]+x[u[2]])\y),2));v}
Note: As presented here by default, is intended to be used with lists of odd numbers like when studying the Goldbach's conjecture.
Contribution from: R. J. Cano (reemmmyyyy at GMail dot com)