If you get a number for each column, i.e. in your example (in decimal) 14, 8, 4, 31, 1, you could just create a number a with n binary digits set to 1 (in this case 31). If this number is equal to one of the column numbers, one of the columns is all 1s.