To specify exactly what I mean with a constant space generator for the digits of pi, consider the following process:

I hook up a microprocessor with n bytes of RAM (for some constant n) and a printer. I start the process. From now on every x cycles one digit in base b of pi will be sent to the printer, until the end of time.

Does such an algorithm exist?

有帮助吗?

解决方案

The answer is no.

Without infinite space, any program must eventually either terminate or start cycling through the same states. Think of "state" as the value of all the memory bytes - including the instruction pointer and everything else - written as a single huge number). A computer is basically a big DFA. If you have 256 bits of state, your program can perform at most 2^256 steps before it starts cycling.

If you are cycling, you are not calculating PI, because it is transcendental.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top