(weird zany solutions II.)
We ask ourselves:
what is the smallest integer which could produce a shuffling of the plugs amongst the sockets?
Shuffling by an integer works as follows: Say we have 6 playing cards from a card deck.
KD, QH, 4S, 6D, 6H, 9C
We want to shuffle them by means of an integer 513. We divide by integer arithmetic, and consider the remainder. We then swap the card on the far right with the card at that position. At each iteration of this procedure, the "far right" shrinks by 1 location. So it is 5 at the first iteration, 4 at the next, 3 at the next etc.
- Code: Select all
0 , 1 , 2 , 3 , 4 , 5
KD, QH, 4S, 6D, 6H, 9C
513/6 = 85 + (rem 3)
Swap 5 with 3.
0 , 1 , 2 , 3 , 4 , 5
KD, QH, 4S, 9C, 6H, 6D
85/5 = 17 + (rem 0)
Swap 4 with 0
0 , 1 , 2 , 3 , 4 , 5
6H, QH, 4S, 9C, KD, 6D
17/4 = 4 + (rem 1)
Swap 3 with 1
0 , 1 , 2 , 3 , 4 , 5
6H, 9C, 4S, QH, KD, 6D
4/3 = 1 + (rem 1)
Swap 2 with 1
0 , 1 , 2 , 3 , 4 , 5
6H, 4S, 9C, QH, KD, 6D
1/2 = 0 + (rem 1)
Swap 1 with 1 .. with itself.
0 , 1 , 2 , 3 , 4 , 5
6H, 4S, 9C, QH, KD, 6D
In the code box above, we shuffled our "deck" of playing cards by means of the integer 513. But notice that repeated divisions ran 513 'dry' after so many divisions. That is, we started to get zeroes near the end. This indicates that 513 is too small of a number to 'encapsulate' the shuffling of six cards. We could have used an enormous integer to start and not run into this problem. Therefore there must exist a smallest sufficient integer for shuffling. Turns out that integer is 720. To get good shuffling amongst six cards, we would need an integer that is
at least 720 (but as large as 1440).
For the bomb problem we imagine a string representing 26 empty sockets, where a period is an empty socket.
- Code: Select all
"..... ..... ..... ..... ..... ."
Place our plugs at the right to start out.
- Code: Select all
"..... ..... ..... ...hg fedcb a"
Now perform the shuffling algorithm. Take an enormous integer to start out , 9,473,684,210,526
Divide by 26, and consider the remainder.
9,473,684,210,526/26 = 364,372,469,635 + (rem 5)
Swap 'a' plug with the letter at position 5.
- Code: Select all
"..... a.... ..... ...hg fedcb ."
Now divide by 25, and consider the remainder. Swap b with that remainder.
Continue this shuffling procedure untill all plugs are "swapped" into the grid of sockets.
We can consider what we divided by in this procedure. And ask what the smallest integer which could 'encapsulate' a shuffling of the plugs? The answer is 26x25x24x23x22x21x20x19 as those are the numbers we would have divided by. QED.