Context: Sorry for a weird question, I'm kind of a technical person, but I'm not good at math -- so I'd be grateful if you could point at what I could read about the following.
I was designing an interface to add cumulative calculations to my python lib and stumbled across a thing, which surprised me. Not to bring the whole problem, here is a piece of trivial Python code:
value = 1
for i in range(2, 1000):
value = i / value
print(i, value)
It just goes over a sequence of numbers from 2 to 1000 and calculates cumulative division, here are first and last 10 lines the output:
2 2.0
3 1.5
4 2.6666666666666665
5 1.875
6 3.2
7 2.1875
8 3.657142857142857
9 2.4609375
10 4.063492063492063
...
990 39.44456819288283
991 25.123864841263767
992 39.48437098621571
993 25.149191317918266
994 39.52413369617162
995 25.174492315219993
996 39.563856443604955
997 25.19976790991399
998 39.60353934876404
999 25.2250181783608
I was curious about the ratio: 39.60353934876404 / 25.2250181783608 = 1.5700103392883897. For some reason it was close to $\frac{\pi}{2}$.
I increased the number of iterations:
import math
value = 1
for i in range(2, 1000000):
value_ = i / value
if i % 1000 == 0:
x = (value_ / value if value_ > value else value / value_) * 2
print(i, x, abs(math.pi - x))
value = value_
990000 3.14159424025328 1.5866634868189067e-06
991000 3.141594238652194 1.585062400888404e-06
992000 3.1415942370543477 1.5834645545886872e-06
993000 3.1415942354597197 1.5818699266034741e-06
994000 3.141594233868303 1.5802785098273375e-06
995000 3.1415942322800725 1.5786902793912816e-06
996000 3.141594230695048 1.5771052548352316e-06
997000 3.1415942291131915 1.5755233984116046e-06
998000 3.141594227534505 1.5739447118967576e-06
999000 3.1415942259589693 1.5723691761948544e-06
and it made it even more interesting :) Not only the value became more precise, but its error got digits from $\frac{\pi}{2}$. What is a name of this thing? (so I could go and search the net for this)
Thank you!