Skip to main content
Became Hot Network Question
edited tags
Link
Source Link

Getting all solutions to an equation on condition the variables are either 0 or 1

Given a list of 3-bit binary lists

b={{0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}};

I would like to have all possible solutions to

s={0,1,0};
Mod[a[2] b[[2]] + a[3] b[[3]] + a[4] b[[4]] + ... + a[8] b[[8]], 2] = s

where each variable a[i] is either 0 or 1.

For instance;

Mod[{1,0,0} + {1,1,0},2]=={0,1,0}

for which a[5]=1 and a[7]=1 and all others 0.

Is this possible with Mathematica?