#!/usr/bin/env ruby -n
is_prime = [false, false] + Array.new($_.to_i, true)
is_prime.each.with_index do |p, i|
  next unless p
  ((i*i)...is_prime.size).step(i).each do |j|
    is_prime[j] = false
  end
end
p is_prime.select{|a|a}.size