Skip to content

Instantly share code, notes, and snippets.

@gaurish
Created August 25, 2012 06:36
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 gaurish/3461601 to your computer and use it in GitHub Desktop.
Save gaurish/3461601 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
a = b = c = 0
range = 1..1_00_000 #same as writing 100000 but ruby allows us to insert underscores which makes large numbers easy to read
range.each do |i|
a = a + b + i
b = a * 5678 + i
c = i * i
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment