You don't need to test up to n/2, just floor(sqrt(n)) will do even better you only need to test the primes <= floor(sqrt(n))
You could use ITERATOR_DEBUG_LEVEL=1 or 0 in debug mode; I made a "FastDebug" profile for this, although you will have to recompile dependencies
You don't need to test up to n/2, just floor(sqrt(n)) will do even better you only need to test the primes <= floor(sqrt(n))
You could use ITERATOR_DEBUG_LEVEL=1 or 0 in debug mode; I made a "FastDebug" profile for this, although you will have to recompile dependencies