Removing prime function and using isPrimeOpt function from ceuler library.
Other small refinements.