This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts "limit number:" | |
max = Integer(gets) | |
primes = [] | |
puts "going from 2 to #{max}" | |
(2..max).select do |current| | |
# if current is divisible by any number in the array (that is not itself) it is not prime | |
isPrime = true | |
primes.each do |prime| |
NewerOlder