Scalaっぽくカッコよく書こうとしたら10倍遅くなったでござるの巻
  if (primes.take((Math sqrt i).toInt).indexWhere(i % _ == 0) == -1) {
    primes += i
  }