Data-compression with playing cards

Tim sends us, "A way of encoding binary numbers into playing cards that I thought up. It usually allows many more bits than there are cards. The method can also store binary encoded letters of the English alphabet at less than 2 cards per letter on average, and has a theoretical ability to do less than 1 card per letter."

Tim isn't sure if his method of data-compression is novel or not, and neither am I. If you know of related work, please add it in the comments.

The method treats cards as representing a 1 or 0. Its ability to store more data than just 52 bits comes from the way that cards which can have their position deduced by examining the rest of the pack can be taken out and reused to encode more data.

The data in the cards can also be encrypted to the level of a one-time pad.

I don't know if the method is any use outside of being an interesting mathematical puzzle. It's fairly simple, but I haven't heard of the method anywhere else so I'd be interested to know if I'm the first person to think of it. If not I'd love to know who else has thought of it.

The Implied Card Method for Encoding Data Into Playing Cards. (Thanks, Tim!)

(Image: Six of hearts, a Creative Commons Attribution Share-Alike (2.0) image from leehaywood's photostream)

Notable Replies

  1. I have a way. You take a binary document, express it in base 10, add a decimal point in front and make a notch on a stick that far along the stick (assuming the stick is of unit length)


    All of human knowledge reduced to a notch on a stick!


  2. I wouldn't categorize it as "compression", but yeah, you can actually store a lot of data in the state of a deck of cards. There are 52! possible orderings, which means that you can encode slightly more than 225 bits of data with card order. You could add an extra 52 bits if you encode more information in whether the cards are forwards/backwards.

  3. There are 52! ways to arrange a deck of cards. Any particular arrangement can be seen as the representation of a number written in a variable base system. The rightmost digit is units, and it has 52 possible numerals from 0 to 51. The next digit to the left is 52s, and its possible numerals are 0 to 50. The next digit to the left is (52 x 51)'s, and its possible numerals are 0 to 49. The next digit to the left is (52 x 51 x 50)'s, and its possible numerals are 0 to 48. (To pull this off, number your cards zero to 51; as you use each one, renumber the rest to eliminate the gap.)

    Thus, we can encode any integer between 0 and (52! -1) with a deck of cards. That's ln(52!) / ln(2) bits, which gives us 225 bits free and clear. What sort of message you can wedge into 225 bits is a separate problem than how many bits a deck of playing cards can represent, but with no compression at all, 5 bits a character gives us 26 letters plus a little punctuation, and our 225 bits gets us 45 of these characters.

  4. You assumed it was more than that? Hubris.

Continue the discussion

20 more replies