Eficient algorithms in number theory