Magic and Algorithms