This reduces the time to 8ns from 250ns for @btime isprime($(prevprime(2^16))). It's slightly slower for small non-primes (numbers with a smallest factor less than 13), but it means that for all small numbers, isprime will take very little time (less than 10ns)
This reduces the time to 8ns from 250ns for
@btime isprime($(prevprime(2^16)))
. It's slightly slower for small non-primes (numbers with a smallest factor less than 13), but it means that for all small numbers,isprime
will take very little time (less than 10ns)