Skip to content

Instantly share code, notes, and snippets.

@rramsden
Created January 21, 2011 22:54
Show Gist options
  • Save rramsden/790597 to your computer and use it in GitHub Desktop.
Save rramsden/790597 to your computer and use it in GitHub Desktop.
require 'rainbow'
puts "enter a number"
mod = Integer(gets)
(0..mod-1).each do |i|
row = ""
(0..mod-1).each do |j|
if ((j * i) % mod) == 1
row += " #{(j * i) % mod}".ljust(3).color(:red)
else
row += " #{(j * i) % mod}".ljust(3).color((i*j) % 255, 255, 255)
end
end
puts row
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment