Skip to content

Instantly share code, notes, and snippets.

@ShivamMistry
Created October 22, 2012 23:39
Show Gist options
  • Save ShivamMistry/3935563 to your computer and use it in GitHub Desktop.
Save ShivamMistry/3935563 to your computer and use it in GitHub Desktop.
Calculates 999999^2^20 and stores the value in base 16 to a file
def calc()
x = 999999
20.times{x = x * x}
return x
end
t1 = Time.now
x = calc()
t2 = Time.now
print (t2-t1).to_s + "s taken to calc 999999^2^20\n"
File.open('numbers.txt', 'w') do |f2|
f2.puts x.to_s(16)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment