Shor's algorithm for factoring and discrete log. I’ll assume you've heard of this algorithm, since it was one of the major scientific achievements of the late twentieth century, and is why we're talking about these things in the first place. If you haven't seen it, there are about 500000 expositions on the Web.