The complexity of some solving some mathematical problem in one direction as opposed to the simplicity of the operation in the other direction makes it suited for assymetric encryption.

The factoring of prime numbers is one of those complex problems. Others are

It's very easy to calculate two prime numbers and multiply them. Factoring that large number back to the two primes is extermely hard.

So, the public and privare keys are made up from a pair of large prime number.

As long as noone finds an easy way to factor into primes, then it stays safe. That may change in the future.

A practical algorithm using this is RSA. Have a look here how it is done: http://world.std.com/~franl/crypto/rsa-guts.html

Or more detailed: http://en.wikipedia.org/wiki/RSA

J.