Skip to content

Instantly share code, notes, and snippets.

@BonyChops
Last active March 14, 2022 08:09
Show Gist options
  • Save BonyChops/55f3e3234fabc3de4c21dd84714c3216 to your computer and use it in GitHub Desktop.
Save BonyChops/55f3e3234fabc3de4c21dd84714c3216 to your computer and use it in GitHub Desktop.
1kpi-ruby
require 'bigdecimal/util'
sum = 0
2090.times do |i|
t = (10 ** 1000) / ((2 * i + 1)* (3 ** (i + 1)))
sum += t if i % 2 == 0
sum -= t if i % 2 == 1
end
sum *= 6
sum *= Integer.sqrt(3 * (10 ** 1000) ** 2)
puts sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment