Fermat's little theorem produced pseudoprimes and I had to get rid of them from the result