Solve deprecation warning

And reduce allocation while we're at it
Eq/Ord changes
Improve sieve memory usage
Add a (non-sieve-based) primality test to libshared