Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

the generate_primes function is now in lib/jprime_tools.rb and is not…

… needed here.
  • Loading branch information...
commit 0e7256080b5a2d8747690d629b0f05444522d8dd 1 parent 28fcb03
@jmstacey authored
Showing with 0 additions and 36 deletions.
  1. +0 −36 jprime_worker.rb
View
36 jprime_worker.rb
@@ -11,42 +11,6 @@
require 'lib/jprime_tools'
# require 'profile'
-# Generate primes between m <-> n
-def generate_primes(m, n, multiples)
- puts "Generating primes between #{m} and #{n}"
-
- m = 2 if m < 2 # safety check, silly users
-
- cap = Math.sqrt(n) + 1
- primes = (m..n).to_a
-
- i = 0
- while i < multiples.length
- p = multiples[i]
- i += 1
-
- break if p >= cap
-
- if (p >= m)
- start = p*2
- else
- start = m + ((p - m % p)%p)
- end
-
- j = start
- while j <= n
- primes[j-m] = nil
- j += p
- end
- end
-
- return primes.compact
-end
-
-##############################
-# Worker stuff #
-##############################
-
DRb.start_service
ts = Rinda::RingFinger.primary
multiples = (ts.read [:multiples, nil])[1]
Please sign in to comment.
Something went wrong with that request. Please try again.