Skip to content

Instantly share code, notes, and snippets.

@MelanieS
Created November 1, 2012 14:24
Show Gist options
  • Save MelanieS/3993911 to your computer and use it in GitHub Desktop.
Save MelanieS/3993911 to your computer and use it in GitHub Desktop.
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