Extract all prime number logic to primes.js