Skip to content

Instantly share code, notes, and snippets.

@lzyzsd
Forked from dchentech/n1.rb
Created June 13, 2012 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lzyzsd/2921378 to your computer and use it in GitHub Desktop.
Save lzyzsd/2921378 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