0

I have the following bit sequence and I am trying to determine it's parity but I am insure of the answer.

1010101010101011

Since the number of 1's is 9, can I assume that the parity is odd?

1 Answers1

0

Yes. The parity of this sequence is odd, as shown by this tool:

var input = document.getElementById("bits");
var parity = document.getElementById("parity");
input.addEventListener("keyup", function(e) {
  this.value = this.value.replace(/[^01]/g, "");
  parity.innerText = this.value ? (this.value.match(/1/g)||[]).length % 2 ? "odd" : "even" : "";
});
<input id="bits"/><br />
Parity: <span id="parity"></span>
wizzwizz4
  • 6,140
  • 2
  • 26
  • 62