Estimating π with François Viète’s Infinite Product

Long before computers existed, mathematicians were already trying to pin down the value of π using clever geometric constructions and infinite processes. One of the earliest breakthroughs came from a French mathematician named François Viète (1540–1603), who discovered one of the first known infinite product formulas in mathematics.

Viète’s work is especially remarkable because it predates calculus. Instead of using series or integrals, he built π using an infinite sequence of nested square roots derived from geometry.

The Viète Formula for π

Viète discovered that π can be expressed as an infinite product:
\frac{2}{\pi} = \frac{\sqrt{2}}{2} \cdot \frac{\sqrt{2 + \sqrt{2}}}{2} \cdot \frac{\sqrt{2 + \sqrt{2 + \sqrt{2}}}}{2} \cdot \cdots

Rearranging this formula gives:
\pi = \frac{2}{\displaystyle \prod_{n=1}^{\infty} a_n}

Where each term is built recursively:

  • a_1 = \frac{\sqrt{2}}{2}
  • a_2 = \frac{\sqrt{2+\sqrt{2}}}{2}
  • a_3 = \frac{\sqrt{2+\sqrt{2+\sqrt{2}}}}{2}

And so on…

  • a_n = \frac{\sqrt{2+\sqrt{2+\sqrt{2+\cdots}}}}{2}

As the number of terms (n) increases, the product converges slowly but steadily towards π.

Python Challenge

Your task is to write a Python program that estimates the value of π using Viète’s infinite product. However instead of computing infinite terms, you will approximate the value of π using a fixed number of iterations.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!