After touring the globe to accolades when performing his 10-card trick and 8-card trick, the magician noticed that the public's interest had waned, as had his own. Needing something to reinvigorate his act, he returned to an idea he pigeonholed long ago: the 7-card trick. Identifying four face-down cards from a group of seven would be something never before seen.
He took the 0 card from his 8-card deck and tossed it aside. With the cards numbered 1 to 7, he shuffled a while, flipped a bit, and after some time exclaimed "Eureka!" Hurriedly, he grabbed a note card and scribbled down the instructions for his assistant. Then he grabbed another and wrote instructions for himself.
The trick works in the following way:
- The implements are cards numbered from 1 to 7 and a layout with seven spots where cards are placed.
- At the beginning of the trick the magician leaves and is unable to communicate with anyone.
- A volunteer is selected and places one card, face up, on each layout spot in any desired arrangement.
- The assistant then points to four of the cards that the volunteer flips over in-place on the layout.
- The magician returns from isolation and is able to identify the number on each of the four face-down cards.
This a mathematical trick with no communication or collusion of any kind. The volunteer could place the cards randomly and the trick would still work. If the rest of humankind died while the magician was in isolation, he could still return and identify the values of the face-down cards (to somewhat muted applause).
This succinct description is blatantly stolen from @ais523's question and adapted for this one:
(Here's an equivalent formulation for the mathematicians and computer scientists out there: write a function whose input is a permutation of the list
[1, 2, 3, 4, 5, 6, 7], and whose output is equal to the input except that four of the elements are replaced with
"?", such that different inputs map to different outputs.)
There's one other restriction that the magician and assistant were working under: they wouldn't be able to take pages of notes with them when performing the trick, so whatever their strategies were, they would have to be simple enough to memorise; listing a separate strategy for each of the 5040 possible inputs isn't a reasonable answer here.
What are the instructions for the assistant and for the magician to perform this trick?