Simulates Shor's Algorithm for factoring.