I just read that this formula was discovered by Ramanujan in the early 20th century.
Not really. He may have rediscovered it - does anyone know if he did, and where? - but it goes back to Lambert in 1768. The history is here:
https://en.wikipedia.org/wiki/Gauss%27s_continued_fraction
And in fact the appearance of π in this formula is a complete red herring! It's true with any number replacing π.
Let's dig into it a little more.
(1/n)