Skip to content

Instantly share code, notes, and snippets.

@briandiaz
Created June 2, 2014 20:15
Show Gist options
  • Save briandiaz/ceec1346cf2bace1d3d8 to your computer and use it in GitHub Desktop.
Save briandiaz/ceec1346cf2bace1d3d8 to your computer and use it in GitHub Desktop.
=begin
Author: Brian Díaz
=end
require 'prime'
File.open(ARGV[0]).each_line do |line|
if(line != nil)
primes = Prime.take_while { |prime| prime < line.to_i }
output = ""
primes.each { |prime| output += prime.to_s + ","}
print "#{output[0..output.length-2]}"
end
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment