Magic Trick solutions

Magic Trick was solved using Octave by 3 contestants. Solution sizes: average 4919 bytes (shortest: 657; longest: 13176).