http://en.wikipedia.org/wiki/AKS_primality_test