Skip to main content
2 of 2
added 105 characters in body

The below sudo code will generate the total number of parity bits for a given word of a size (2^n bits):

Integer parityBits = 0;

while (powerOf(2, parityBits) < parityBits + wordLength + 1) {
   parityBits++;
}

Note: I have not tested this solution against words with a length different than (2^n bits)