3 ms·
while(calculate_pi_stream(10 /* substring length */) != 0987654321);
by rockstar-guy-23 3y ago
while(calculate_pi_stream(10 /* substring length */) != 0987654321);
- redjamjar 3y agoHaha, yeah ... this one you would have a very hard time with :) Hopefully, though, termination of your program does not depend on this ... otherwise could be a long wait!
- nine_k 3y agoI remember there was a theorem that one can find an arbitrary substring in a long enough output of infinite (stationary) random process. I also suppose that a decimal representation of pi may count as one, then your function provably terminates. But this is of a theoretic interest. In practice the verifier says: "I can't prove that this function will terminate within (some reasonable window), program rejected". And this is what's actually needed: a program that provably has certain properties, where an automatic proof is tractable.
- xigoi 3y agoIt is currently not known whether π is a normal number (that is, its representation in any base contains any finite sequence of digits with the same density as in a uniformly random string of digits).