TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Calculating Pi in 5 lines of Python

1 pointsby swagasaurus-rex3 months ago

2 comments

westurner3 months ago
&gt; <i>Infinite series can&#x27;t really be calculated to completion using a computer,</i><p>The sum of an infinite <i>divergent</i> series cannot be calculated with or without a computer.<p>The sum of an infinite <i>convergent</i> series can be calculated with:<p><pre><code> 1&#x2F;(a-r) </code></pre> Sequence &gt; Limits and convergence: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Sequence#Limits_and_convergence" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Sequence#Limits_and_convergenc...</a><p>Limit of a sequence: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Limit_of_a_sequence" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Limit_of_a_sequence</a><p>SymPy docs &gt; Limits of Sequences: <a href="https:&#x2F;&#x2F;docs.sympy.org&#x2F;latest&#x2F;modules&#x2F;series&#x2F;limitseq.html" rel="nofollow">https:&#x2F;&#x2F;docs.sympy.org&#x2F;latest&#x2F;modules&#x2F;series&#x2F;limitseq.html</a><p>&gt; <i>Provides methods to compute limit of terms having sequences at infinity.</i><p>Madhava-Leibniz formula for π: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Leibniz_formula_for_%CF%80" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Leibniz_formula_for_%CF%80</a>
chrism2383 months ago
And how thousands of lines of C, below, to actually get the work done?