Sha256: ffb42227f08a450593489992f0ae6e86d7da5c859d3e94cb858b8b6929340629

Contents?: true

Size: 280 Bytes

Versions: 6

Compression:

Stored size: 280 Bytes

Contents

# encoding: utf-8

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

6 entries across 6 versions & 1 rubygems

Version Path
amqp-0.7.5 examples/primes-simple.rb
amqp-0.7.4 examples/primes-simple.rb
amqp-0.7.3 examples/primes-simple.rb
amqp-0.7.2 examples/primes-simple.rb
amqp-0.7.1 examples/primes-simple.rb
amqp-0.7.0 examples/mq/primes-simple.rb