Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'prime'
- primes = Array.new
- counter = ARGV[0].to_i
- counter = 30 if counter == 0
- (2..counter).to_a.each { |x|
- if Prime.prime? x then
- primes << x
- end
- }
- x = primes
- y = primes
- print ' '
- x.each {|i| print "%-3d " % i}
- print "\n "
- x.each {|i| print '---- '}
- print "\n"
- y.each do |j|
- print "%-3d| " % j
- x.each {|i| print "%-3d " % (i*j)}
- print "\n"
- end
Advertisement
Add Comment
Please, Sign In to add comment