Sha256: b68ea67dd7acb20f30a7c10083f47affbaf38718feda57dca1dcd5a5034019bf
Contents?: true
Size: 509 Bytes
Versions: 36
Compression:
Stored size: 509 Bytes
Contents
#!/usr/bin/env ruby # encoding: utf-8 # You are probably wondering what the smeg is this example all about. # Check examples/primes.rb, the only point of this file is to compare # with its RPC implementation. require "bundler" Bundler.setup MAX = 1000 class Fixnum def prime? ('1' * self) !~ /^1?$|^(11+?)\1+$/ end end class PrimeChecker def is_prime?(number) number.prime? end end prime_checker = PrimeChecker.new (10_000...(10_000 + MAX)).each do |n| prime_checker.is_prime?(n) end
Version data entries
36 entries across 36 versions & 1 rubygems