16
$\begingroup$

Problem: Ashley and Ivan want to impress their friends and come up with a magic trick:

One of their classmates comes up with 4 unique random numbers between 1 and 27 and tells them to Ivan. Ivan shares only 3 of the numbers with Ashley and she always guesses the fourth one. No other information is shared between them.

What is the arrangement that Ivan and Ashley have beforehand?

$\endgroup$
  • 8
    $\begingroup$ This is essentially a numerical version of this 5 card trick problem. $\endgroup$ – Jaap Scherphuis Sep 25 '18 at 8:41
  • 1
    $\begingroup$ @JaapScherphuis It seems to be a bit trickier to me, although perhaps I'm missing something. $\endgroup$ – hexomino Sep 25 '18 at 10:18
  • 1
    $\begingroup$ By that, I mean, the surjective map that Ivan and Ashley have to construct has a lot less freedom than in the 5 card trick problem. In fact, it appears to be a bijection. $\endgroup$ – hexomino Sep 25 '18 at 10:31
  • 4
    $\begingroup$ Here is another post about the same card trick. The answer for that question should work for this one as well. $\endgroup$ – Jaap Scherphuis Sep 25 '18 at 11:34
  • 1
    $\begingroup$ A little backstory - I got this question from e 4th grade advanced mathematics book. They shouldn't be familiar multiplication/division $\endgroup$ – Lirik Vesur Sep 25 '18 at 12:33
6
$\begingroup$

Since 3 numbers are known to Ashley, the missing 4th can be one of the remaining 24 (since all 4 are unique).

Ivan can name 3 shared numbers in 6 different orders, and can insert the secret one in 4 different position (before 1st, after 1st, after 2nd, after 3rd), so we get 24 different combinations, so, it's a bijection, and Ashley can always guess the secret number.

Example of an arrangement:

Let $A$, $B$ and $C$ be the shared numbers, and they are ordered such $A<B<C$. Consider the following table, which can serve as an arrangement:

Sum up the numbers which correspond to the true sentences, and add to the answer the number of shared numbers which are less or equal than that answer.

  • order is ABC = 1
  • order is ACB = 2
  • order is BAC = 3
  • order is BCA = 4
  • order is CAB = 5
  • order is CBA = 6
  • missing number on 1st position = 0
  • missing number on 2nd position = 6
  • missing number on 3rd position = 12
  • missing number on 4th position = 18

For example, Ivan can say to Ashley:

The numbers are 8, 16, X, and 5. You must guess the X.

So, Ashley deducts that the order of numbers is $BCA$ (since $5<8<16$), and the missing number is named on third position. So the answer is $4+12=16$. Since all 3 numbers are less or equal than 16, Ashley adds 3 and gets the secret number: 19.

Note: The last step is used to map the 24 numbers from 1 to 24 to the 24 numbers from 1 to 27 except the already named numbers, namely $\{1,2,...,24\}\to\{1,2,...,27\}\setminus\{A,B,C\}$

Edit: Since Ivan has the freedom of what number he can remove, he has 4 times more possibilities than there are at first glance. So he can "encode" it without including the unknown number into the message (for example, remove the number based on the sum of all 4 numbers modulo 4 - if they sum to $4n+1$, remove the smallest number, $4n+2$ - 2nd smallest etc.), reducing the number of possible variation to no more than 6.

$\endgroup$
  • 5
    $\begingroup$ I am skeptical that you would be allowed to place the unknown number in the order like that. $\endgroup$ – hexomino Sep 25 '18 at 11:09
  • $\begingroup$ @hexomino Why not? The problem only states that one side shares 3 numbers with the other and "hiding" the 4th. For unprepared spectators this phrase may sound natural. $\endgroup$ – trolley813 Sep 25 '18 at 11:15
  • $\begingroup$ @trolley813 I agree with hexomino, you would not able to say 8,16,X, 5... but 8,16,5... I thought the same methodology but I am pretty sure it would not be possible to do this. $\endgroup$ – Oray Sep 25 '18 at 11:24
  • $\begingroup$ @trolley813 good idea, but you only get 3 numbers $\endgroup$ – Lirik Vesur Sep 25 '18 at 11:39
  • 2
    $\begingroup$ @LirikVesur Yes, it's actually possible to use the other way for "encoding", I've edited the answer. But, please place a requirement in the puzzle, that Ashley gets from Ivan only 3 numbers and nothing else. $\endgroup$ – trolley813 Sep 25 '18 at 12:38
0
$\begingroup$

Arrangement:

Tell the 3 random numbers A, B and C in a specific order (based on their value) and each number one or two times to communicate a position between 1 and 24, like this: ABC = 1 AABC = 2 ABBC = 3 ABCC = 4 ACB = 5 AACB = 6 ACCB = 7 ACBB = 8 BAC = 9 BBAC = 10 BAAC = 11 BACC = 12 BCA = 13 BBCA = 14 BCCA = 15 BCAA = 16 CAB = 17 CCAB = 18 CAAB = 19 CABB = 20 CBA = 21 CCBA = 22 CBBA = 23 CBAA = 24 When the position between 1 and 24 is known, count forward and jump past the A, B and C numbers to know the actual forth number between 1-27.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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