Good question.  I think the numbers are 7777 though, at least thats the highest i can ever get on the transponders i have flown with.  I cannot however answer your question, but i am sure it has something to do with the amount of different combinations you can make from four numbers ranging from 0 to 7.  I suck at math so i don't know how to exactly say how many combinations are possible, but i think it is like 7 to the fourth or something like that.