My attempt to recreate the algorithm described in the RSA wikipedia article.