Page 1 of 1

Computing pi in binary

Posted: Thu Oct 03, 2019 7:03 pm
by swni
I put this on reddit and forgot to crosspost here in case anyone was interested. I computed the first 455 binary digits of pi in 3 hours and 43 minutes.

Explanation video (I suggest 1.5x speed if you find my typing too slow): https://www.youtube.com/watch?v=67XC8s5fG_g
Reddit thread: https://old.reddit.com/r/factorio/comme ... _factorio/

I don't show what all the combinators do in the video because it was too long already :) If you want the save file or have questions, I am typically more responsive on reddit than here.

Re: Computing pi in binary

Posted: Fri Oct 04, 2019 4:49 pm
by Koub
You may want to give a look at this :
viewtopic.php?f=193&t=76357

Re: Computing pi in binary

Posted: Sun Oct 06, 2019 7:39 pm
by swni
Thanks for the link. It's quite slick, and is a clever combinator creation, but my own goal was to make a computer that computes pi: the relevant distinction here being that a computer (in the sense of computer science) has a fixed size, rather than growing to accommodate the thing being computed.

Of course in Factorio this is not a completely clear distinction, because signals are limited to 32-bit and there is no access to infinitely large memory: my pi computer fails at around 2^16 binary digits because of the 32-bit limitation on signals, but if signals were allowed to be any integer then it could be made to go forever. Technically with the 32-bit limit any computer in Factorio is a finite state machine, and by the pumping lemma can only compute rational numbers, and therefore cannot compute pi exactly.

https://en.wikipedia.org/wiki/Pumping_l ... _languages

Re: Computing pi in binary

Posted: Sun Oct 06, 2019 8:02 pm
by swni
On second thought, if you relaxed the 32-bit restriction on signals, there are a wide variety of formulas for pi that could be calculated "in place", and it would be a little underwhelming to have a 20 combinator computer spitting out hundreds of digits of pi. The only consolation for the BBP formula is that it only needs O(log(n)) space to compute n digits, whereas the other formulas I am aware of need O(n) space to compute n digits.