The Chudnovsky Algorithm
LizFoster (102)

(NOTE: It only does 18 iterations, as if you try to do any more, it raises an OverflowError, how lame.. -__-)

わーい, another π approximation method! (I do love these things. π is gorgeous, is it not?)

This is one of the fastest formulae for π out there, used to approximate out to 50 TRILLION DIGITS of π, in January of this year!

The notation for this in Σ is very long, so I have provided a screenshot of it, from its Wikipedia page:

Feedback is greatly appreciated, please enjoy!

If you are interested in learning more, this is the Wikipedia page:

(EDIT: Wow! I am glad this was a bit of a conversation starter for you all, thank you so much for all the upvotes!!)

You are viewing a single comment. View All
bgrubert (123)

Wow, this is really impressive - I've never managed to program this algorithm my self. Do you know why 18 iterations are only giving 15 digits of pi? I thought this algorithm was supposed to do 14 digits per term.

Andi_Chin (142)

@LizFoster python does not have unlimited precision

CodeABC123 (191)

Of course. Even humans are not perfect. @Andi_Chin

CodeABC123 (191)

Things humans are not good at:

  • helping the earth
  • not being selfish
  • helping lions


52eagle (22)

@CodeABC123 yah humans made python