Skip to content
Pi Calculator (without using imports, Circles, Pi, or non-terminating numbers!)
Profile icon

Pi Calculator

So, I wanted to make a Pi calculator without imports. I figured I could just use circles, but I would have to use Pi to render the circles in Python without imports (to my knowledge)... So, in search of calculating Pi, I came upon the Leibniz formula. My script started out about 100 lines long but I got it down real small; however, though, this formula was very inefficient, and I ended up with the Nilakantha formula. It's really fast and generates a lot of digits. I'm kinda proud of it, so I hope you guys like it too. If anyone knows how I could make it faster or more accurate, I'm open to any suggestions!

You are viewing a single comment. View All
Profile icon

Ah okay, cool! Thanks for sharing :)