If you are carrying a standard 52 card pack of cards (no jokers) what is the largest key size, or the amount of data the cards can hold?
Without the cards being marked or distinguishable from an identical pack, but some cards may be placed in the deck upside down.

  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$ – SEJPM Dec 9 '18 at 18:23
  • $\begingroup$ I honestly forgot about cards like the ace of hearts having a picture face up top and bottom, and thought there was only the 'magic trick' of finding cards that are printed with a noticeable angular offset. I thought all cards looked like these: ksr-ugc.imgix.net/assets/001/854/579/… $\endgroup$ – daniel Dec 10 '18 at 7:14
  • $\begingroup$ @daniel Well, also have a look at number 7 in the suite I posted in my answer. It's clearly different when rotated around. $\endgroup$ – Paul Uszak Dec 10 '18 at 10:56
  • $\begingroup$ @PaulUszak the number 7 was never my friend cdn.pixabay.com/photo/2012/04/11/13/42/… $\endgroup$ – daniel Dec 11 '18 at 7:23

Assuming that

  • we can encode information with:
    • the order of the cards;
    • which face is up;
    • rotation of cards by 180° as clearly distinguishable on a standard deck of cards as pictured below, that is for 7 of tile, and ace, 3, 5, 6, 7, 8, 9 of clover, heart, and spade;
  • that when "carrying" a deck of cards:
    • we keep the cards together so that relative displacement of the cards does not cause loss of the above;
    • but sliding of cards as occurring in casual handling prevents encoding more information (e.g. by small rotation or translation of the cards);
    • and we loose track of the whole deck orientation, including what side was initially up, and if the deck was rotated;

then we can encode $\left\lfloor\log_2(52!)+52+(1+7\times3)-2\right\rfloor\ =\ 297$ bits, with spare capacity such that for over 49% of the keys, we can have two different representations.

I have blatantly stolen the following illustration from that other answer: standard deck

Note per comment: We loose at least two bits because we can't tell which side is up and the orientation of 7 tile. We loose no more because once that is used as reference (with the deck re-oriented so that, by sliding cards, 7 spade is observable and in the orientation of the picture), we can define a position starting from top for each of the 52 cards, determine which side is up for the 51 other cards, and the rotational orientation of 21 others.

  • $\begingroup$ Stealing is wrong. Accept a fine of one upvote for me please :-) $\endgroup$ – Paul Uszak Dec 10 '18 at 15:36
  • $\begingroup$ @PaulUszak Soliciting and trading for upvotes is also wrong... $\endgroup$ – Ella Rose Dec 10 '18 at 17:50
  • $\begingroup$ @Paul Uszak: I paid in advance, and can only pay once. Here is an extra 👍 $\endgroup$ – fgrieu Dec 10 '18 at 17:51
  • $\begingroup$ The −2 I do not fully understand, I see the need to tell which side of the deck to start from, but if you have a rule like "start the deck with Ace of hearts" then its obvious to someone who knows about it. $\endgroup$ – daniel Dec 11 '18 at 6:49
  • 1
    $\begingroup$ @fgrieu but now any deck of cards with the 7 of diamonds (tile) face up is suspicious. OH! the card can be anywhere in the deck, and when decoding we go through the deck until its found and then start from there. $\endgroup$ – daniel Dec 11 '18 at 7:43

Any set of $N$ distinguishable objects can be permuted in $N!$ different ways, thus giving you the ability to represent $N!$ different keys, resulting in a representable keylength of $\log_2(N!)$ bits. For $52$ distinguishable playing cards, this would be $\approx 225$ bits.

However with the additional property, that each object can have two distinguishable states -- a card can be face up or face down in the deck -- we can encode one additional bit of Information per card, since for each permutation there are $2^N$ different configurations. For your $52$ playing cards with the two states "face up" and "face down" you can thus represent $52!\cdot 2^{52}$ many keys, or a key length of $277$ bits.

  • 4
    $\begingroup$ Beware that decks of cards may not be rotationally invariant; many cards, even in standardized decks, may have a different look when put upside down rather than face up / face down. It is possible to use this kind of data as well, but by default such information is ignored by all parties, and the amount of data varies for each deck. $\endgroup$ – Maarten Bodewes Dec 9 '18 at 15:54

The question relates to the amount of information that can be encoded within a standard pack of cards. The cards can be face up or face down. It is reasonable to assume therefore that they can also be rotated as in reality, who arranges a deck so that all the hearts are the right way up?

You would have to decide out of band what the interpretation of the up/down/rotated cards was. Otherwise it would be impossible to understand the encoding correctly. For example, face down = "0" and hearts & clubs & spades as per their physical equivalents = "0".

Take the following typical deck from the interweb:-


These face cards have 180 degree symmetry so can be excluded from additional encoding. But some of the other cards have only 360 degree symmetry(eg. 3-hearts). Considering all that, we get:-

$log_2(52!) + 52 + 22 = \textbf{299}$ bits without resorting to more exotic encoding techniques like folding the corners down. That's 52! for the permutation, plus one for each face up/down possibility, plus another 22 bits for cards that don't have 360 degree rotational symmetry. About a novemvigintillion possible choices.

Some face cards also have 360 degree symmetry and that depends on the clothing design, so the total encoding may be higher for those decks.

  • 1
    $\begingroup$ What you write is not wrong, however it's probably not the expected answer to the question as posed. If the only defined states of the cards are "right side up" and "upside down" (whatever is meant by that) then you cannot use any other properties of the cards to encode anything. ( Because the decoder would not know what to look for.) $\endgroup$ – Maeher Dec 9 '18 at 16:20
  • $\begingroup$ Pff, only novemvigintillion in the short scale :P $\endgroup$ – Maarten Bodewes Dec 9 '18 at 16:27
  • $\begingroup$ @Maeher It's the same principle as face up/down. Suite normal/inverted is another bit/card for appropriate cards of which I count 22. And rotation seems a common and relevant occurrence. $\endgroup$ – Paul Uszak Dec 9 '18 at 18:08
  • 2
    $\begingroup$ When "carrying" a deck, is there some inherent reference for what up and down are, and 180° rotation? We should remove 1 bit for each such missing reference. $\endgroup$ – fgrieu Dec 9 '18 at 20:06
  • $\begingroup$ @fgrieu I guess that would have to be established out of band beforehand. It's common to think that for general thingies "down = 0", "up = 1", hearts and clubs are normally "up" and spades are "down" in line with their physical equivalents. But you're right. Edit needed... $\endgroup$ – Paul Uszak Dec 9 '18 at 21:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.