Fortune Telling Collection - Fortune-telling birth date - How to play magic?

How to play magic?

Some "fortune tellers" will play a little game with you before telling your fortune: put several large pieces of paper in front of them, each with some surnames written on it. Then, you don't have to talk, just point out which sheets of paper have your surname, and he will tell you your surname quickly with high accuracy. "Ten to nine" is right. At this time, when you admire the "master" more, the "master" will let you pay him to tell your fortune and ask about your future, fortune, marriage and so on. ?

We all know that fortune telling is false, but why do they guess surnames? In fact, as long as you know the binary number, you can perform this magical magic by yourself. Whether you know binary or not, as long as you read after me carefully, you will know what this magic is all about. ?

The secret of this magic trick is to associate each surname with a number, and then convert this number into a binary representation. The number of sheets of paper represents the number of bits of binary numbers, that is, each sheet represents a number, and several sheets of paper should be prepared if there are several numbers. If there is this surname on the paper, it will be represented by 1. If there is no such surname, it will be 0. Let's give a simple example first: suppose there are 10 people trying magic, and there are 10 different surnames: Zhang, Wang, Li, Zhao, Liu, Yu, Xu, Jin, Qian and Sun. We code them into 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 in turn, and then express the number of 10 in binary (please refer to some computer introductory books for the conversion between binary and decimal), and then convert it into binary. The number of 10 correspondingly becomes 1, 10,100, 1 10,10.

Zhang? Wang? Lee? Zhao? Liu? Yu? Xu? Kim. Money? Sun?

1? 10? 1 1? 100? 10 1? 1 10? 1 1 1? 1000? 100 1? 10 10?

Because Sun corresponds to 10 10, which is four digits, and each piece of paper corresponds to one digit, so we should prepare at least four pieces of paper. The first paper represents the first number, the second paper represents the second number, the third paper represents the third number, and the fourth paper represents the fourth number (the first number, the second number, the third number, and the fourth number are all from right to left, equivalent to decimal units, ten, hundred, and thousand). Because it has been said before that "if there is this surname on a piece of paper, it will be represented by 1, and if there is no such surname, it will be represented by 0", so the number of digits marked on each piece of paper is 1, that is, after the code of the surname written on the paper is converted into binary, the number of digits must be 1. We simply call these four pieces of paper first, second, third and fourth respectively. So these surnames should be written on these four pieces of paper:

With these cards, we can play magic and "know your last name without asking". If you indicate your surname on the second and fourth cards, it means that the code corresponding to your surname is converted into binary, and the second and fourth digits are 1, that is, 10 10. At this time, you only need to look it up in the "surname table" you prepared to know which surname it is. Of course, this "list" should be made in advance and kept in a hidden place for future reference, so as not to be seen by others to show mystery. It would be best if you could recite it. It's tempting to set up a street stall on the road. You can't just have a surname of 10. Maybe you should have 100 surnames on your Surnames List, because the maximum number of surnames is 100, which is between 26 and 27. The first eight digits of the binary (1000000) correspond to the decimal number (128), so only seven cards need to be prepared, but each card has at most 50 surnames instead of five. There may be less than 64 students in your class (and two or three people with the same surname can be regarded as one person, so there may even be less than 32 students with different surnames). Then as long as you make five or six cards, you can play surnames in the classroom, but you can't claim to know magic and fortune telling. You just know a math game.