1

This is a related question poker hand representation and I got a great accepted answer. The problem can be reduced to a virtual 39 card deck that from what I can tell is 16 bits.

I have 5 numbers 1-39 with none repeating. I need to uniquely identity those 5 numbers with the smallest possible number and not order dependent on the 5. I am pretty sure the number is 2^16. From the accepted answer to the link you go 01, 10, 100, ... and then start folding back. Then use an XOR on that matrix. I tried but I cannot figure out when / how to start folding back.

What is the matrix / array?

paparazzo
  • 431
  • 3
  • 13

1 Answers1

3

This can't be encoded into 16 bits. The number of such hands is ${39 \choose 5} = 575757$ (is that a pretty number or what?), and $\lg(575757) \approx 19.1$, so a 5-card hand be encoded into 20 bits, but it can't be encoded in 16 bits.

You can use the methods shown there (1, 2) to construct an encoding into 20 bits. Alternatively, if you want a coding-theory-based answer, analogous to Yuval's answer there (the accepted answer), you'll need to find a linear code of appropriate parameters. 16 bits isn't enough. Even 20 bits won't be enough; you'll need a slightly longer encoding, as the coding-theory-based solutions are fast to compute but yield an encoding that is slightly-longer-than-optimal.

D.W.
  • 167,959
  • 22
  • 232
  • 500