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.

Show HN: Happy Pi day with this PWA to cut 100k Pi digits offline

1 pointsby imcottonabout 1 year ago
It using JavaScript native BigInt and Chudnovsky Algorithm ([wiki]), the code was taken from one of the examples in the QuickJS project ([quickjs&#x2F;pi], [pi_bigint.js]).<p>The syntax for cutting:<p><pre><code> pi#6 &#x2F;&#x2F; take 6 digits of Pi (314_159) pi#6#3 &#x2F;&#x2F; take 6 digits of Pi but drop 3 beforehand (159_265) pi#1#40000 &#x2F;&#x2F; take one digit at 40,000th </code></pre> It uses service workers to cache static files, by the time it opens up you already free to be offline, try toggle network switch to verify.<p>It has download link at bottom of the about page ([accdoo.app&#x2F;about]) which you could then self host it by dropping into any static hosting services.<p>btw, the Pi feature was by-product from the original App but I won&#x27;t expand here, if you&#x27;d like to learn more, please checkout its Show HN post (39115559, 39138957 and 39238295) previously.<p>[wiki]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Chudnovsky_algorithm" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Chudnovsky_algorithm</a><p>[quickjs&#x2F;pi]: <a href="https:&#x2F;&#x2F;bellard.org&#x2F;quickjs&#x2F;pi.html" rel="nofollow">https:&#x2F;&#x2F;bellard.org&#x2F;quickjs&#x2F;pi.html</a><p>[pi_bigint.js]: <a href="https:&#x2F;&#x2F;github.com&#x2F;bellard&#x2F;quickjs&#x2F;blob&#x2F;master&#x2F;examples&#x2F;pi_bigint.js">https:&#x2F;&#x2F;github.com&#x2F;bellard&#x2F;quickjs&#x2F;blob&#x2F;master&#x2F;examples&#x2F;pi_b...</a><p>[accdoo.app&#x2F;about]: <a href="https:&#x2F;&#x2F;accdoo.app&#x2F;about#releases" rel="nofollow">https:&#x2F;&#x2F;accdoo.app&#x2F;about#releases</a><p>[39115559]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39115559">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39115559</a><p>[39138957]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39138957">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39138957</a><p>[39238295]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39238295">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39238295</a>

no comments

no comments