Eratosthenes' Sieve - javascript function