Sha256: 5db9ec2f8a1d3707f29ecf2a02c240d38667200f30e37538fab6550e2d5659cc

Contents?: true

Size: 342 Bytes

Versions: 3

Compression:

Stored size: 342 Bytes

Contents

module PrimeNumberGenerator
  class PrimeNumbersController < ApplicationController
    layout "report"
    
  	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

3 entries across 3 versions & 1 rubygems

Version Path
prime_number_generator-0.3 app/controllers/prime_number_generator/prime_numbers_controller.rb
prime_number_generator-0.2 app/controllers/prime_number_generator/prime_numbers_controller.rb
prime_number_generator-0.1 app/controllers/prime_number_generator/prime_numbers_controller.rb