Skip to content

Instantly share code, notes, and snippets.

@noqisofon
noqisofon / example.rb
Created November 17, 2012 07:54 — forked from ww24/example.js
Prime - 10万以下の素数を表示
require 'benchmark'
Benchmark.bm( 8 ) do |reportor|
reportor.report( "1000: " ) {
primes = []
1000.times do |x|
x += 1
if x != 1 and primes.all? { |y| x % y != 0 } then
primes << x