All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General
Magic trick (Posted on 2007-05-11) Difficulty: 3 of 5
Two magicians A and B perform the following trick:

A leaves the room and B chooses 4 members from the audience at random. Each member chooses a card numbered from 1 to 100 (each chooses a different card) and after B has seen their cards he chooses a card from the remaining deck of cards. The 5 chosen cards are shuffled by an audience member and handed to A who just returned to the room. Prove that A is able to figure out which cards each member picked. Consider that the chosen members form a row and e.g. the leftmost member picks the first card and the rightmost member (B) picks the last card.

No Solution Yet Submitted by atheron    
Rating: 4.1667 (6 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re: Some statistics -- continued | Comment 36 of 51 |
(In reply to Some statistics by Charlie)

* 28  49  97  67  84 
    67     28     49     84     97
    67     97     28     49     84
    84     97     49     28     67
    97     67     28     84     49
* 47  33  87  60  34
    60     33     34     87     47
    47     33     34     87     60
* 56  3  88  45  57
* 17  19  61  7  100
    7     17     100     61     19
* 94  89  86  95  39
* 85  39  46  83  63
    39     46     83     63     85
    83     85     39     46     63
* 42  14  67  1  31
    42     67     1     14     31
    14     67     1     31     42
    42     1     31     67     14
* 59  35  68  55  29
    29     68     59     55     35
    35     55     29     59     68
* 22  44  37  99  34
    34     22     37     99     44
* 37  98  30  27  24
    27     24     30     98     37
* 67  53  94  46  59
    53     46     94     59     67
* 32  18  9  82  47
    32     18     9     82     47
    47     9     82     18     32
* 46  35  5  97  60
* 28  47  34  85  71
    47     28     71     34     85
    71     28     34     85     47
    85     47     34     28     71
* 89  21  12  47  13
    13     12     89     47     21
* 16  50  84  69  78
* 6  24  60  99  79
    79     99     60     6     24
* 18  61  66  93  51
* 53  39  49  82  91
    39     82     91     49     53
* 63  97  15  90  95
* 39  98  41  69  58
    41     98     39     58     69
    69     98     39     41     58
* 39  50  75  68  53
    50     39     53     68     75
* 1  65  89  34  46
    46     89     65     34     1
* 91  53  47  19  57
* 24  52  75  6  56
    56     75     52     6     24
* 45  52  26  65  34
    45     26     34     52     65
* 64  84  34  26  13
    26     13     84     64     34
* 81  36  58  26  40
    40     81     36     26     58
    58     40     26     36     81
* 89  33  23  9  31
    9     23     89     31     33
* 95  4  93  20  23
    4     93     20     95     23
* 62  20  63  51  25
    20     63     51     62     25
* 12  69  16  17  3
    3     12     16     69     17
* 18  23  49  66  74
    18     74     49     66     23
* 47  33  74  100  20
    74     20     47     100     33
    74     20     100     33     47
* 78  19  16  63  23
    16     63     78     19     23
* 84  48  11  72  83
* 36  17  70  65  90
    90     17     65     70     36
* 82  23  90  84  14
    82     84     14     90     23
* 9  25  23  8  60
    8     9     60     23     25
* 50  30  61  2  46
* 9  54  59  92  49
* 25  100  34  46  93
    34     100     93     25     46
* 45  77  13  24  81
    45     81     13     77     24
    81     24     13     77     45
* 9  23  5  24  40
    23     9     24     5     40
* 71  60  90  80  63
    63     71     80     60     90
* 74  98  27  32  60
    27     98     60     74     32
* 96  95  72  34  12
    96     72     95     12     34
* 51  9  29  35  92
    92     9     51     35     29
    35     29     92     9     51
* 86  22  8  37  77
    77     8     86     37     22
    77     22     8     86     37
* 97  65  48  27  24
    48     97     24     27     65
    97     27     24     65     48
* 73  75  17  71  15
    15     71     75     73     17
* 28  49  31  89  68
    68     31     28     49     89
    68     89     31     28     49
    89     28     31     49     68
* 66  86  34  35  87
    34     66     86     87     35
* 83  85  72  51  39
    85     51     39     83     72
    39     51     83     72     85
    72     85     83     39     51
* 65  11  24  78  7
    65     7     11     78     24
* 38  4  71  49  72
* 45  41  80  78  58
    78     41     45     80     58
    41     45     78     58     80
* 38  9  57  44  37
* 64  61  54  70  7
* 32  68  73  84  64
* 7  67  92  97  64
* 55  76  24  62  50
* 52  37  34  30  45
    34     30     37     45     52
* 84  37  10  66  79
* 45  5  80  57  51
* 85  52  87  38  16
    87     52     85     16     38
    85     16     87     38     52
* 12  72  13  24  9
    12     72     9     13     24
* 44  37  64  85  58
    64     44     37     58     85
    37     85     58     44     64
* 97  98  56  45  61
    45     98     56     97     61
* 63  23  86  38  55
    63     55     23     38     86
    63     55     23     86     38
    63     86     23     38     55
    38     23     86     55     63
* 1  15  82  46  79
    79     1     82     46     15
* 48  8  24  3  27
    27     8     3     24     48
* 38  54  83  7  70
    83     70     54     38     7
* 69  25  47  78  84
    84     47     78     25     69
    84     69     78     25     47
    25     78     69     47     84
* 90  46  26  35  77
    35     90     26     77     46
* 86  18  42  32  66
    86     42     32     18     66
    32     66     86     18     42
    66     18     42     32     86
* 1  76  52  86  93
    76     52     93     86     1
* 68  96  19  28  86
    68     86     19     96     28
* 97  75  7  34  24
    24     75     97     7     34
    75     97     7     34     24
* 4  10  76  68  91
    4     91     76     68     10
* 14  92  67  79  25
    67     92     14     79     25
* 63  59  7  50  79
* 59  90  82  70  58
    59     58     82     70     90
* 7  12  62  54  23
    12     62     7     54     23
* 74  67  99  39  2
* 82  78  54  26  28
    26     54     82     78     28
* 10  67  81  6  76
    6     76     81     67     10
* 96  47  80  66  19
    96     80     47     66     19
* 16  81  63  51  77
* 47  37  35  34  77
    35     37     77     34     47
* 76  63  41  10  37
* 21  69  41  62  95
    41     21     62     95     69
    95     21     69     62     41
    95     41     21     69     62
* 48  76  96  13  50
* 24  18  78  92  11
    11     92     78     18     24
* 44  66  52  83  90
    52     44     66     83     90
    83     44     90     52     66
* 64  75  91  62  85
    62     85     75     64     91
* 27  14  78  6  82
    78     6     14     82     27
* 13  12  35  28  6
    12     6     13     28     35
* 67  94  100  69  39
* 37  66  86  97  65
* 95  73  29  9  72
    95     9     73     72     29
* 48  20  18  24  78
    78     24     20     18     48
    18     48     78     20     24
* 93  30  22  9  49
    22     9     93     49     30
    93     9     22     30     49
* 49  32  2  28  59
* 87  12  2  50  92
    50     87     92     2     12
* 76  87  83  53  40
    83     40     76     87     53
    87     83     40     53     76
    40     76     83     53     87
* 83  66  23  97  34
    66     97     23     83     34
* 67  82  64  25  42
    82     42     67     25     64
    64     42     25     67     82
    67     82     25     64     42
* 38  74  88  99  53
    53     88     38     74     99
    74     38     99     53     88
    88     74     38     99     53
    99     53     38     88     74
* 96  46  76  95  82
* 76  48  16  36  98
    98     16     76     48     36
    36     98     76     16     48
* 65  49  9  85  5
    5     65     85     49     9
* 40  21  12  60  98
    40     60     12     98     21
    98     12     21     60     40
    98     12     40     21     60
* 6  8  41  68  81
    6     41     81     68     8
* 55  13  37  41  96
    96     55     41     13     37
    41     13     96     37     55
* 52  60  81  77  28
    81     77     60     28     52
    28     60     77     52     81
    52     28     81     77     60
* 7  43  8  11  46
    7     43     8     46     11
* 79  58  8  42  57
* 62  18  80  70  63
* 12  22  91  80  48
    48     80     91     12     22
* 82  37  90  96  25
    82     96     90     25     37
* 68  47  4  95  19
    68     47     4     95     19
* 71  70  74  52  65
    52     70     65     71     74
* 32  84  62  47  74
    47     62     74     32     84
    74     47     32     84     62
    74     62     32     84     47
* 11  44  37  25  27
    25     11     27     37     44
* 15  88  100  42  78
* 2  78  74  7  57
    2     78     57     74     7
* 3  47  68  69  13
    47     68     69     3     13
* 6  50  71  87  68
    87     50     68     71     6
* 36  24  26  89  87
    26     87     89     24     36
* 47  50  62  60  78
    60     50     62     47     78
* 29  33  45  54  50
    29     45     50     33     54
* 29  20  8  33  85
    8     29     85     20     33
* 62  76  68  87  65
    65     76     62     68     87
* 66  26  49  94  62
    94     66     26     62     49
    26     62     94     49     66
* 13  87  5  80  36
    36     5     87     80     13
    87     80     5     13     36
* 12  73  71  100  39
* 57  45  28  32  75
    32     75     45     28     57
    45     57     32     28     75
    57     28     32     75     45
* 25  6  62  17  54
    17     6     62     54     25
* 1  76  46  21  33
    21     76     46     1     33
    33     1     21     76     46
    76     1     46     33     21
* 6  8  93  5  98
    5     6     98     93     8
* 2  34  22  49  66
    22     66     49     2     34
    34     22     2     66     49
    34     49     2     22     66
    66     2     49     34     22
* 14  91  41  17  9
    91     17     14     9     41
    9     41     14     91     17
* 89  25  54  17  80
    54     17     89     80     25
* 100  6  9  83  78
    6     83     78     100     9
* 34  65  17  99  33
    17     33     65     99     34
* 8  91  87  61  70
    87     91     61     70     8
* 97  24  6  92  85
    92     97     85     6     24
* 19  72  67  63  3
    67     63     72     3     19
* 97  91  24  50  88
* 46  100  23  88  11
    46     100     88     11     23
    100     88     11     23     46
* 36  45  62  94  91
    62     91     36     94     45
    91     94     36     45     62
* 90  16  88  69  9
    69     9     88     90     16
* 31  53  64  71  30
    71     31     64     30     53
    31     30     53     64     71
* 30  42  36  64  66
    30     66     64     36     42
    30     36     64     42     66
* 40  48  32  76  94
    40     32     94     76     48
* 57  13  26  88  66
    66     13     57     88     26
* 35  39  96  63  29
    96     39     35     29     63
    29     63     96     35     39
* 72  86  10  59  94
    86     72     94     59     10
* 12  81  22  100  32
    22     81     100     12     32
* 34  52  72  56  68
    34     56     68     52     72
* 54  76  42  62  88
    54     76     62     42     88
    62     42     88     54     76
* 17  7  25  48  19
    25     19     7     17     48
    7     48     19     17     25
* 78  9  34  72  15
    9     78     72     34     15
    78     9     15     72     34
* 36  63  78  43  39
    43     39     36     63     78
    78     36     43     39     63
* 20  38  89  42  9
    38     89     9     42     20
    9     38     89     20     42
* 99  46  74  29  22
    74     99     22     29     46
* 62  97  73  78  55
    78     55     62     73     97
* 64  60  69  49  7
* 83  73  43  36  87
    73     36     83     87     43
* 13  96  81  67  55
    81     96     55     67     13
* 43  42  1  27  34
* 78  95  62  96  10
    95     62     96     78     10
* 65  74  25  59  34
    59     65     25     74     34
* 45  99  98  62  54
    54     45     99     98     62
* 16  38  96  18  59
    96     16     59     18     38
    96     18     16     38     59
* 36  46  60  84  28
    46     28     84     36     60
    60     46     36     28     84
* 87  9  38  84  88
* 19  92  95  61  12
    61     12     92     95     19
* 10  78  35  51  34
    35     34     78     10     51
    78     51     35     10     34
* 8  64  34  2  78
    2     78     64     34     8
* 48  13  86  84  90
* 45  53  25  64  58
    64     25     58     53     45
    25     58     53     45     64
* 44  27  30  57  82
    44     27     30     82     57
    57     27     82     30     44
* 36  55  44  60  8
* 39  17  91  90  95
    95     90     91     17     39
* 67  7  64  35  93
* 22  71  87  38  9
    71     9     38     87     22
    71     22     87     9     38
* 67  45  55  17  95

The statistics for number of legitimate chosen sets that lead to the given clue set are:

  0    1    2   3   4   5     total trials
 111  241  93  41  13   1     500


 
That prize-winning 5-ways-to-get-there set was 36  15  71  93  54, where any one of the numbers could have been the one chosen by B as the clue card.

So these 500 "possible" sets of 5 can represent any of  241 + 93*2 +41*3 + 13*4 + 1*5 = 607 originally chosen sets by the audience (with B's addition). I put "possible" in quotes, as the ones with zero ways of getting there are, by the rules, impossible.  The ratio 607/500 = 1.214 compares to P(100,4)/C(100,5) = 1.25.  If we tried more, the ratio would likely get more closely approximated.

DECLARE SUB permute (a$)
match$ = "1234,1243,1324,1342,1423,1432,2134,2143,2314,2341,2413,2431,"
match$ = match$ + "3124,3142,3214,3241,3412,3421,4123,4132,4213,4231,4312,4321"
chc = 100

CLS

OPEN "cardtric.txt" FOR OUTPUT AS #2

FOR trial = 1 TO 500

  list5$ = ""
  PRINT #2, "*";
  FOR i = 1 TO 5
   DO
    n = INT(RND(1) * chc + 1)
    nn$ = CHR$(n)
    IF INSTR(list5$, nn$) = 0 THEN
      list5$ = list5$ + nn$: PRINT #2, n; : EXIT DO
    END IF
   LOOP
  NEXT
  PRINT #2,

  'CLS
  list5h$ = list5$
  mct = 0
  DO
    FOR i = 1 TO 4
      n = ASC(MID$(list5$, i, 1))
      cd(i) = n
      orig(i) = n
    NEXT
    propExtra = ASC(MID$(list5$, 5, 1))
   
    DO
     done = 1
     FOR i = 1 TO 3
      IF cd(i) > cd(i + 1) THEN SWAP cd(i), cd(i + 1): done = 0
     NEXT
    LOOP UNTIL done

    seq$ = ""
    FOR i = 1 TO 4
      FOR j = 1 TO 4
        IF orig(i) = cd(j) THEN seq$ = seq$ + LTRIM$(STR$(j))
      NEXT
    NEXT

    Z = (INSTR(match$, seq$) + 4) / 5

    cd(5) = cd(1) + chc
    FOR i = 1 TO 4
     IF cd(i + 1) - cd(i) > 24 THEN ak = cd(i): EXIT FOR
    NEXT
    newNumb = ak + Z
    IF newNumb > chc THEN newNumb = newNumb - chc

    IF newNumb = propExtra THEN
     mct = mct + 1
     FOR i = 1 TO 4
      PRINT #2, "   "; orig(i);
     NEXT
     PRINT #2, "   "; newNumb
    END IF
   
    permute list5$
    'LOCATE row, col
    'FOR i = 1 TO 5: print#2, ASC(MID$(list5$, i, 1)); : NEXT
    'row = row + 1
    'IF row > 47 THEN
    ' col = col + 21: row = 1
    'END IF
    REM
  LOOP UNTIL list5$ = list5h$
  oct = oct + 1
  ctr(mct) = ctr(mct) + 1

NEXT trial
  FOR i = 0 TO 5
    PRINT #2, ctr(i);
  NEXT
  PRINT #2, , oct
  CLOSE
END

SUB permute (a$)
DEFINT A-Z
 x$ = ""
 FOR i = LEN(a$) TO 1 STEP -1
  l$ = x$
  x$ = MID$(a$, i, 1)
  IF x$ < l$ THEN EXIT FOR
 NEXT

 IF i = 0 THEN
  FOR j = 1 TO LEN(a$) 2
   x$ = MID$(a$, j, 1)
   MID$(a$, j, 1) = MID$(a$, LEN(a$) - j + 1, 1)
   MID$(a$, LEN(a$) - j + 1, 1) = x$
  NEXT
 ELSE
  FOR j = LEN(a$) TO i + 1 STEP -1
   IF MID$(a$, j, 1) > x$ THEN EXIT FOR
  NEXT
  MID$(a$, i, 1) = MID$(a$, j, 1)
  MID$(a$, j, 1) = x$
  FOR j = 1 TO (LEN(a$) - i) 2
   x$ = MID$(a$, i + j, 1)
   MID$(a$, i + j, 1) = MID$(a$, LEN(a$) - j + 1, 1)
   MID$(a$, LEN(a$) - j + 1, 1) = x$
  NEXT
 END IF
END SUB

Edited on May 14, 2007, 11:48 pm
  Posted by Charlie on 2007-05-14 23:44:58

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (12)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information