What would be the fastest way to check if a given large number is prime? I'm talking about numbers the size of around 10^32. I've tried the algorithm from the great answer by @MarcoBonelli which is:
from math import sqrt; from itertools import count, islice
def isPrime(n):
return n > 1 and all(n%i for i in islice(count(2), int(sqrt(n)-1)))
but it gives the error of Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize
when used against such large numbers. What would be a different, fast way to do it then?