Created
November 1, 2012 14:24
-
-
Save MelanieS/3993911 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
puts "Enter a starting number for your range" | |
range_begin = gets.chomp.to_i | |
puts "Enter the ending number for your range" | |
range_end = gets.chomp.to_i | |
range = (range_begin..range_end) | |
dirty_prime_list = [] | |
range.each do |x| | |
euler = x**2 + x + 41 | |
puts euler | |
dirty_prime_list.push(euler) | |
end | |
puts "Here's your list of potential primes:" | |
#puts dirty_prime_list.to_s | |
puts "Saving result to output file 'dirty_list.out'" | |
fh = File.new("dirty_list.out", "w") | |
fh.puts dirty_prime_list | |
fh.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment