Skip to content

Instantly share code, notes, and snippets.

@dchentech
Created October 4, 2011 12:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dchentech/1261488 to your computer and use it in GitHub Desktop.
Save dchentech/1261488 to your computer and use it in GitHub Desktop.
1、11、111、1111、……的平方
# http://www.bjt.name/2011/06/beautiful-math-triangle-r/
proc do |line|
(1..line).each do |num|
puts "#{' '*(line - num)}#{('1'*num).to_i**2}"
end
end.call((ARGV[0] || 36).to_i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment