<<   >>

6. Perfect Shuffle

x[⍋⍒(⍴x)⍴0 1]

 

Perfect shuffle, a special case of a solution to the more general mesh problem described by Ken Iverson [8b] and solved by Luthor Woodrum [23]. The phrase was found on the back of I.P. Sharp T-shirts in the 1970s and 1980s.

   x←'ABCDEFGHIJKLMNOPQ'
   x[⍋⍒(⍴x)⍴0 1]
IAJBKCLDMENFOGPHQ

⍋⍒n⍴0 1 is a permutation of length n . Its order is the minimum number of times a perfect shuffle has to be applied to yield the original argument [24, 25]. The sequence of these orders is A024222 in the indispensible On-line Encyclopedia of Integer Sequences [26].