Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 884917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:49:26+00:00 2026-05-15T12:49:26+00:00

Out of pure interested, I’m curious how to create PI sequentially so that instead

  • 0

Out of pure interested, I’m curious how to create PI sequentially so that instead of the number being produced after the outcome of the process, allow the numbers to display as the process itself is being generated. If this is the case, then the number could produce itself, and I could implement garbage collection on previously seen numbers thus creating an infinite series. The outcome is just a number being generated every second that follows the series of Pi.

Here’s what I’ve found sifting through the internets :

This it the popular computer-friendly algorithm, The Machin-like Algorithm :

def arccot(x, unity)
   xpow = unity / x
   n = 1
   sign = 1
   sum = 0
   loop do
       term = xpow / n
       break if term == 0
       sum += sign * (xpow/n)
       xpow /= x*x
       n += 2
       sign = -sign
   end
   sum
end

def calc_pi(digits = 10000)
   fudge = 10
   unity = 10**(digits+fudge)
   pi = 4*(4*arccot(5, unity) - arccot(239, unity))
   pi / (10**fudge)
end

digits = (ARGV[0] || 10000).to_i
p calc_pi(digits)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:49:27+00:00Added an answer on May 15, 2026 at 12:49 pm

    To expand on “Moron’s” answer: What the Bailey-Borwein-Plouffe formula does for you is that it lets you compute binary (or equivalently hex) digits of pi without computing all of the digits before it. This formula was used to compute the quadrillionth bit of pi ten years ago. It’s a 0. (I’m sure that you were on the edge of your seat to find out.)

    This is not the same thing as a low-memory, dynamic algorithm to compute the bits or digits of pi, which I think what you could mean by “sequentially”. I don’t think that anyone knows how to do that in base 10 or in base 2, although the BPP algorithm can be viewed as a partial solution.

    Well, some of the iterative formula for pi are also sort-of like a sequential algorithm, in the sense that there is an iteration that produces more digits with each round. However, it’s also only a partial solution, because typically the number of digits doubles or triples with each step. So you’d wait with a lot of digits for a while, and the whoosh a lot more digits come quickly.

    In fact, I don’t know if there is any low-memory, efficient algorithm to produce digits of any standard irrational number. Even for e, you’d think that the standard infinite series is an efficient formula and that it’s low-memory. But it only looks low memory at the beginning, and actually there are also faster algorithms to compute many digits of e.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to abstract out pure SQL calls in my code as much
Out of order execution in CPUs means that a CPU can reorder instructions to
Out of curiousity, is there any way to edit an existing synonym? That is,
Out of pure curiosity, is there a way to free the memory used by
Is there a good way of printing out a jQuery object as pure HTML?
I have been trying out ilog jrules for sometime now.I especially interested in rule
There seem to be a few good pure Python SSH2 client implementations out there,
I know this is a micro-optimization, so I ask out of pure curiosity. Logically,
I wish to lock out access to a user's EDIT page (eg. /user/pure.krome/edit) if
how do i write a Logo thats made out of pure css so its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.