learned sieve of eratosthenes!
change max to limit