Little speed up, by filtering B vectors

Generate only those vectors, which will result in a sum = 0.
Generating vector B iterative instead of recursive
Cleaning code up, comments
Filter vector B for sum1 and sum2 = 0

Number for i = 0 is actually A081671, and is calculated with a recursion
First try using integers (bitwise) instead of lists
Filter vector B, so that sum1 = sum2 = 0
calculate the sum instead of looking in a table