Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Hamming code and distance

  1. Sep 30, 2009 #1
    *Devise a code for the digits 0 to 9 whose Hamming distance is 2.*

    My efforts to answer this problem are kind of hard to explain, but I'll try. First I wrote out the digits 0 to 9 in binary. Then I tried to find a number that was only 2 numbers different from each one (get 2 ones when XOR them), but there was no single code that worked for all 9 numbers. I found one that worked from 0 to 7, but once the digits changed to 1000 it didn't work anymore.

    Am I even approaching this right? Please help.
  2. jcsd
  3. Sep 30, 2009 #2


    User Avatar
    Homework Helper

    You need 3 redunancy bits for a distance of 2, which allows you to correct single bit errors. Since it takes 4 bits to represent the numbers 0 through 9, you need a 7 bit code.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook