Sha256: 8eb7474b1fad324f151ebef2e3a3a3a7907f041c4a67b52e86c95f54b27e5389

Contents?: true

Size: 386 Bytes

Versions: 2

Compression:

Stored size: 386 Bytes

Contents

require_dependency "prime_number_generator/application_controller"

module PrimeNumberGenerator
  class PrimeNumbersController < ApplicationController
  	 def start_form
    end	

    def generator
  		@prime_numbers = []
      number = params[:limit].to_i
	    (2..number).each do |i|
	 		@prime_numbers << i if (2..i/2).to_a
	 									  .all?{|e| i%e != 0}
	 	end

  	end	
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prime_number_generator-0.0.8 app/controllers/prime_number_generator/prime_numbers_controller.rb
prime_number_generator-0.0.7 app/controllers/prime_number_generator/prime_numbers_controller.rb